PCA and High-Dimensional QC
Upon completing this topic
You will understand PCA as a transformation that summarizes high-dimensional data into low-dimensional coordinates, and you will be able to inspect scaling, batch, and outlier effects separately. You will explain the limitation that proximity in a PCA plot does not automatically imply biological similarity.
Visualizing many columns across a few axes
In high-dimensional matrices, it is difficult to examine differences between samples across all features simultaneously. PCA transforms directions with high variance into new axes and represents the samples with a smaller number of coordinates. Because principal components depend on the scaling and feature selection used, record the preprocessing contract before interpreting the plot.
QC questions
Before creating a PCA, verify the following:
- Are rows and columns samples or features?
- Are they raw counts or transformed/normalized values?
- Are feature scales comparable to each other?
- To what extent do batch and biological condition overlap?
- What are the sample IDs and replicate structures of outlier candidates?
Even if samples cluster by batch in the PCA, do not automatically conclude that batch is the cause. Examine measurement quality, library size, sample composition, and study design together.
Python preprocessing and PCA
from sklearn.decomposition import PCAfrom sklearn.preprocessing import StandardScaler
X_scaled = StandardScaler().fit_transform(X)pca = PCA(n_components=2)coordinates = pca.fit_transform(X_scaled)print(pca.explained_variance_ratio_)This code assumes a numeric matrix where features are columns. Record the scope of StandardScaler fitting, missing value handling, feature selection, and split units if applicable. The explained variance ratio is a summary of the chosen input, not a ranking of biological importance.
Separating outliers and batch
Points far from the center may be a combination of input errors, technical failures, genuine biological variation, and batch differences. Do not remove points based solely on their position; verify raw data, metadata, and replicates. If you repeat PCA with multiple preprocessing steps, record the sensitivity by noting which patterns persist across settings.
Returning to research questions for interpretation
PCA is a coordinate representation useful for QC and exploration. Do not interpret the direction of principal component axes themselves as biological mechanisms, nor translate proximity directly into independence, causation, or disease state. Return to the original feature units and batch design to verify.
Common failures
- Do not hide whether scaling was applied.
- Do not refer to PCA plot axes as effect sizes or significance.
- Do not delete outliers based solely on the plot.
- Do not write that PCA resolves confounding between batch and condition.
Key takeaways
- PCA is a dimensionality reduction and exploration tool dependent on input preprocessing.
- Scaling, batch, and outlier are distinct QC questions.
- Coordinate proximity does not automatically indicate biological cause or causation.
Next topic
The next module covers multiplicity and shrinkage together in high-dimensional feature-wise testing.
References
- scikit-learn common pitfalls: https://scikit-learn.org/stable/common_pitfalls.html
- scikit-learn metrics: https://scikit-learn.org/stable/modules/model_evaluation.html
- NCBI GEO: https://www.ncbi.nlm.nih.gov/geo/info/
The matrix and PCA examples in this module were written independently by BioStatPy.