Write Publication-Ready PCA Artifacts
write_pca_publication_artifacts.RdConverts validated PCA coordinates and eigenvalues into canonical tables, vector and raster figures, manuscript methods text, a figure caption, source data, and machine-readable validation checks.
Usage
write_pca_publication_artifacts(
coordinates,
eigenvalues,
metadata = NULL,
output_dir,
palette = NULL,
module = "pca",
variance_percent = NULL
)Arguments
- coordinates
Data frame containing
sample_id,PC1, andPC2.- eigenvalues
Numeric PCA eigenvalues, for reference/diagnostic display only.
- metadata
Optional data frame containing
sample_idandpopulation.- output_dir
Analysis output directory.
- palette
Optional named population colour vector.
- module
Artifact module name.
- variance_percent
Optional pre-computed percent-of-total-variance for each component (same length/order as
eigenvalues), on a 0-100 scale. Required whenevereigenvaluesis a truncated subset of a larger spectrum (e.g.SNPRelate::snpgdsPCA(eigen.cnt = N)'s retained-only eigenvalues):eigenvalues / sum(eigenvalues)is only the true percent of TOTAL variance wheneigenvaluesis the complete spectrum, and silently inflates every percentage otherwise. Defaults toNULL, which falls back to treatingeigenvaluesas the complete spectrum – correct only when it genuinely is.