Multiway principal component analysis score extraction
Use when after preprocessing and aligning 2D chromatogram data (baseline correction, smoothing, peak alignment) and after running m_prcomp multiway PCA on the joined chromatogram matrix.From its SKILL.md
npx -y skills add HolobiomicsLab/asb-skill-collections --skill multiway-principal-component-analysis-score-extractionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
7.0 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
Multiway Principal Component Analysis Score Extraction
Summary
Extract principal component scores from preprocessed GCxGC-MS chromatogram data after multiway PCA decomposition using Wold's approach. This skill recovers the projection of individual samples onto the reduced principal component space, enabling downstream sample-level visualization and classification.
When to use
Apply this skill after preprocessing and aligning 2D chromatogram data (baseline correction, smoothing, peak alignment) and after running m_prcomp multiway PCA on the joined chromatogram matrix. Use it when you need to obtain sample-level coordinates in PC space for visualization, clustering, or as input to supervised classification models (e.g., mixOmics).
When NOT to use
- Input chromatograms have not been preprocessed (smoothed, baseline-corrected, peak-aligned) — scores will reflect noise and misalignment artifacts.
- m_prcomp has not yet been run on the chromatogram matrix — the m_prcomp object does not exist.
- Scores are not the appropriate output — if you need loading vectors or explained variance, use plot_loading() or print_mpca() functions instead.
Inputs
- m_prcomp object (output from multiway PCA on preprocessed, aligned chromatogram matrix)
- Preprocessed 2D chromatogram data (joined via join_chromatograms function)
Outputs
- MPCA scores matrix (samples × principal components)
- Sample coordinates in reduced PC space suitable for visualization and classification
How to apply
After running m_prcomp with specified parameters (e.g., center=TRUE, scale=FALSE), call the scores() function on the resulting m_prcomp object to extract the scores matrix. This matrix contains principal component coordinates for each preprocessed chromatogram (rows) across the computed principal components (columns). The choice of center and scale parameters affects the interpretation: center=TRUE removes mean intensity offsets, while scale=FALSE preserves intensity variance structure without standardization. Verify that the extracted scores matrix has dimensions matching the number of input chromatograms and the number of retained PCs.
Related tools
- RGCxGC (Contains m_prcomp function for multiway PCA decomposition and scores() function for score matrix extraction) — https://github.com/DanielQuiroz97/RGCxGC
- mixOmics (Downstream supervised classification using extracted MPCA scores as input features)
Examples
scores_matrix <- scores(m_prcomp_object)
Evaluation signals
- Scores matrix dimensions equal (n_chromatograms, n_retained_PCs) — verify shape matches input and m_prcomp configuration.
- All scores are numeric and finite (no NaN or Inf) after extraction.
- Scores reflect separation between study groups (e.g., S. typhoid carriage vs. control) when visualized in PC1 vs. PC2 plane — absence of separation suggests preprocessing or parameter issues.
- Scores are reproducible across independent runs with identical input and m_prcomp parameters (center, scale, rank).
- Sum of explained variance by extracted PCs matches the cumulative variance reported by print_mpca() function.
Limitations
- Score quality depends entirely on preprocessing quality — poor baseline correction, incomplete peak alignment, or residual noise will propagate into scores.
- center=FALSE and scale=FALSE preserve raw intensity scale, making scores sensitive to instrumental drift or uneven sample concentration; centering and scaling may be needed for robust biological interpretation.
- MPCA assumes trilinear decomposition (Wold's approach); nonlinear structure in chromatogram data may not be captured and should be validated via residual analysis.
- Scores are specific to the selected number of retained principal components; choosing too few PCs loses information, too many overfits noise.
Evidence
- [other] The MPCA scores matrix can be extracted from the preprocessed MTBLS579 dataset (6 chromatograms across S. typhy carriage and control groups) using the scores() function after running m_prcomp with center=TRUE and scale=FALSE, showing the projection of samples in the reduced principal component space.: "The MPCA scores matrix can be extracted from the preprocessed MTBLS579 dataset using the scores() function after running m_prcomp with center=TRUE and scale=FALSE, showing the projection of samples"
- [intro] After signal preprocessing, MPCA can be performed over the dataset by using the m_prcomp functions.: "After signal preprocessing, MPCA can be performed over the dataset by using the m_prcomp functions."
- [intro] you can access to the score matrix through scores function, or plot the loading matrix with the plot_loading function. Finally, the MPCA summary can be retrieved with the print_mpca function.: "you can access to the score matrix through scores function, or plot the loading matrix with the plot_loading function."
- [readme] RGCxGC offers common pre-processing algorithms for signal enhancement, such as baseline correction based on asymetric least squares, smoothing based on the Whittaker smoother, and peak alignment 2D COW. Furthermore, the multiway principal component analysis is implemented based on the Wold's approach.: "the multiway principal component analysis is implemented based on the Wold's approach."
- [intro] Preprocessing steps including smoothing, baseline correction, and peak alignment can reduce noise and reveal differences between groups for multivariate analysis: "Preprocessing steps including smoothing, baseline correction, and peak alignment can reduce noise and reveal differences between groups for multivariate analysis"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.