This repository contains code accompanying 'Phenotypic geometry is heterogeneous across the biological hierarchy'. These analyses characterize the dimensionality, continuity, topology, curvature, ancestry dependence, heritability, and cross-layer recoverability of RNA abundance, protein abundance, and growth phenotypes in 802 natural Saccharomyces cerevisiae isolates.
Install Miniconda and Mamba, then create the pinned R 4.3 environment:
mamba env create --name phenogeometry --file envs/dev.yml
conda activate phenogeometry
Rscript -e 'remotes::install_version("TDAstats", version = "0.4.1", repos = "https://cloud.r-project.org")'The workflow uses base R plus ape, diptest, igraph, lpSolve, mclust, readxl, and TDAstats. TDAstats is installed from CRAN because it is not distributed as a Conda package. No GPU is required.
The repository includes the following inputs:
data/genotypes/1011DistanceMatrixBasedOnSNPs.tab: SNP-distance matrix for the 1,011-isolate panel from Peter et al. (2018).data/genotypes/strain_clades_peter2018_S1.txt: major-clade assignments from Peter et al. (2018).data/41586_2018_30_MOESM3_ESM.xls: Peter et al. (2018) strain metadata used for the phylogeny display.data/phenotypes/loegler_phenos_cleaned_zscore.RDS: cached cleaned analysis matrices so downstream scripts can be run without repeating primary cleaning.
code/00_load_and_clean_data.R downloads Phenotypes_8391Traits.tar.gz from Loegler et al.'s Zenodo record when the source directory is absent and verifies its published MD5 checksum before extraction. Downloaded source files are Git-ignored.
The cleaning script reconstructs the cached object and its companion files from those source files. It intersects strains across layers, removes strains with more than 20% missing growth measurements, removes traits with more than 20% missingness, mean-imputes remaining values, and z-scores each trait. The resulting matrices contain 802 strains and 5,970 RNA, 630 protein, and 241 growth traits.
The generated companion files are:
loegler_phenos_cleaned.RDS: filtered and mean-imputed matrices on the original measurement scales.loegler_phenos_cleaned_zscore.RDS: standardized matrices used by the analyses.loegler_phenos_raw.RDS: NA-preserving matrices on the retained strain set, before trait filtering and imputation.loegler_strains_cleaned.RDS: retained strain identifiers.
code/ ordered R scripts for downloading, cleaning, analyses, and figures
data/ compact inputs, generated phenotype matrices, and ignored downloads
envs/ Conda environment specification
results/ serialized analysis results
figures/ generated manuscript-facing source panels (created on run)
Run commands from the repository root. To regenerate every cleaned data object, result, and script-generated figure panel in order:
Rscript code/99_run_paper_analyses.REach script can also be run independently in the order below. Scripts use seed 42 unless noted, write serialized results to results/, and write graphics to figures/.
| Order | Script | Manuscript output |
|---|---|---|
| 00 | 00_load_and_clean_data.R |
Primary phenotype cleaning and cached matrices |
| 01 | 01_setup.R |
Shared paths, loaders, estimators, and plotting helpers; sourced rather than run directly |
| 02 | 02_tree_measurements.R |
Figure 1 phylogeny and measurement rings |
| 03 | 03_dimensionality.R |
Figures 2–3 dimensionality and strain-rarefaction results |
| 04 | 04_continuum.R |
Figure 4 dip tests, GMM/BIC sweep, and Hopkins comparisons |
| 05 | 05_curvature.R |
Figure 5 curvature calibration and phenotype diagnostics |
| 06 | 06_orthogonal_geometry.R |
Persistent homology plus exploratory orthogonal geometry checks; results only |
| 07 | 07_h0_persistence_nulls.R |
Manuscript-facing H0 persistence null analysis |
| 08 | 08_population_structure_figure.R |
Figure 6 ancestry, heritability, and tree-cut analyses |
| 09 | 09_variance_partition.R |
Figure 7A cross-layer variance partition |
| 10 | 10_variance_partition_figure.R |
Figure 7A rendered source panel |
| 11 | 11_cross_layer_geometry.R |
Figure 7B–C joint PR and pairwise geometry panels; prediction and sufficiency results |
The scripts write only panels used in the paper. Accordingly, the repository reproduces the underlying analyses and script-generated source panels but does not claim pixel-identical regeneration of those three final composites.
For example, the Figure 7 workflow is:
Rscript code/09_variance_partition.R
Rscript code/10_variance_partition_figure.R
Rscript code/11_cross_layer_geometry.RSet PG_ROOT to use a data directory outside the repository, PG_OUT to redirect results/ and figures/, or PG_PHENO_OUT to redirect the cleaned phenotype objects. PG_PHENO_URL can point to an exact mirror of the checksum-verified source archive.
PG_ROOT=/path/to/input-root PG_OUT=/path/to/output-root \
Rscript code/11_cross_layer_geometry.REach analysis saves an RDS file with the same numeric prefix and descriptive stem as its generating script. Existing results in results/ are release snapshots.
The release workflow is CPU-only and runs as serial R scripts. It was developed on a MacBook Pro running macOS 15.7.4 and R 4.3.2.
Code is released under the MIT License. For feedback and contributions, see Arcadia Science's guide to recognizing software contributions.