Function Index & S3 Class System Breakdown
modules.RmdFunction Index & S3 Class System Breakdown
foundr organizes its source code across 45+ source files
in R/. Functions are grouped into five core architectural
categories:
1. Data Analysis & Statistical Modeling
| Function | Primary Role / Description | Source File |
|---|---|---|
partition() |
Decomposes raw trait values into orthogonal signal,
rest, and noise terms |
R/partition.R |
strainstats() |
Computes strain/sex/condition summary stats, standard deviations, cell means, and ANOVA F-tests | R/strainstats.R |
conditionContrasts() |
Calculates differences and contrasts between experimental conditions across founder strains | R/conditionContrasts.R |
bestcor() |
Identifies top correlated traits across founder strains using Spearman rank correlation | R/bestcor.R |
eigen_cor() / eigen_contrast()
|
Computes eigentrait correlations and condition contrast eigentrait projections | R/eigentrait.R |
traitAncova() |
Performs Analysis of Covariance (ANCOVA) combining continuous covariates and strain factors | R/traitAncova.R |
2. Trait S3 Class System & Method Dispatch
foundr implements custom S3 classes to encapsulate
structured trait data and provide unified visualization & summary
APIs.
S3 Classes
-
traitSolos: Represents single-trait data structured for strain comparisons (R/traitSolos.R). -
traitPairs: Encapsulates bivariate trait comparisons, joint distributions, and correlations (R/traitPairs.R). -
traitTimes: Wraps time-series measurement trajectories over time points (R/traitTimes.R). -
conditionContrasts: Encapsulates condition contrast effect estimates and p-values (R/conditionContrasts.R).
3. Module Analysis & WGCNA Integration
foundr integrates with WGCNA module outputs to analyze
co-expression gene modules alongside physiological phenotypes:
-
module_kMEs(): Extracts module eigengene kME values for specified traits (R/module_kMEs.R). -
module_band(): Computes module band intervals across founder strain trait signals (R/module_band.R). -
wgcnaModules()/listof_wgcnaModules(): Constructors for managing single and list-of-WGCNA module specifications (R/wgcnaModules.R).
4. Visualization & Biplot Engine
All plot generators in foundr build upon the centralized
ggplot_template() design system:
| Plot Function | Description | Source File |
|---|---|---|
ggplot_template() |
Core styling template (Okabe-Ito CC color palette, custom themes, facet options) | R/ggplot_template.R |
ggplot_traitSolos() |
Bar charts and point plots for single trait strain values | R/traitSolos.R |
ggplot_traitPairs() |
Scatter plots and correlation grids for paired traits | R/traitPairs.R |
ggplot_traitTimes() |
Longitudinal trajectory plots across experimental time points | R/traitTimes.R |
volcano() |
Volcano plots mapping effect size against statistical significance () | R/volcano.R |
biplot_signal() / biplot_pca()
|
PCA biplot visualizations powered by the ordr
package |
R/biplot.R |
ggplot_evidence_spread() |
Evidence spread and rank variance dot plots | R/evidence_spread.R |
5. Utilities & Data Transformation Helpers
-
nqrank()/normalscores(): Normal quantile rank transformations for non-Gaussian trait normalization (R/nqrank.R). -
area_under_curve(): Integrates trait values across longitudinal time points (R/area_under_curve.R). -
unite_datatraits()/pivot_pair(): Reshaping helpers for combining dataset names and trait identifiers (R/trait_names.R). -
timetraits()/separate_time(): Utilities for parsing time component tags from trait string names (R/timetraits.R).