Research Notes
14 minIntermediateComplete

Exploration

PCA from first principles: what drives variation in matched HGSOC RNA-seq?

Implementing PCA from scratch shows both how it works and when it stops saying what we think it says.

Last updated 25 September 2026

HGSOCRNA-seqPCAReproducibility

What is the PCA separating?

GSE133296 contains ten matched triplets collected during primary debulking surgery: a primary ovarian tumour, an omental metastasis and a non-omental intraperitoneal metastasis from each patient. The question is whether expression profiles follow the person from whom they came or the tissue context in which the tumour was sampled.

10Patients

Shared genetics, evolutionary history and patient-specific tumour biology.

3Samples each

One ovarian, one omental and one non-omental tumour deposit per patient.

FFPEMaterial

Macrodissected tumour areas from archival sections, with the limitations that implies.

Each site appears once per patient. Comparing ten ovarian samples with ten omental samples also carries the differences between patients inside both groups; the matched structure cannot be ignored.

From expression matrix to sample geometry

  1. 01Matrix
  2. 02Centring
  3. 03SVD
  4. 04Scores
  5. 05Loadings
HGSOCGeometry uses the validated GSE133296 analysis snapshot.
Brief video transcript

The animation moves from the expression matrix to centred gene values, shows the singular-value decomposition, then identifies sample scores and gene loadings. The two-gene view illustrates the transformation; the reported PCA uses the complete selected 500-gene matrix.

Every preprocessing choice changes the space PCA sees

The decomposition does not receive “the RNA-seq data” in the abstract. It receives the matrix left behind by filtering, normalisation, transformation and feature selection.

01

Start with what was measured

Raw counts

PC1 explains 53.2% of variance. Its absolute association with sequencing depth is 0.628.

02

Remove low-expression genes

Expression filter

The filter removes 66% of genes while retaining 99.5% of mapped reads.

03

Account for library size

CPM normalisation

Normalising by library size weakens the depth-driven structure.

04

Compress the dynamic range

log₂(CPM + 1)

The logarithm changes which expression differences dominate the distances between samples.

05

Focus the final matrix

Top 500 variable genes

PC1 explains 20.0% of variance and its absolute association with depth falls to 0.164.

01Raw counts
GSE133296

PC1 explains 53.2% of variance. Its absolute association with sequencing depth is 0.628.

Five PC1–PC2 plots showing the RNA-seq matrix at each preprocessing stage.Five PC1–PC2 plots showing the RNA-seq matrix at each preprocessing stage.
Figure 1. The complete preprocessing sequence. Filtering removes 66% of genes but retains 99.5% of reads; from raw counts to the final matrix, PC1 falls from 53.2% to 20.0% and its depth association from 0.628 to 0.164.

Changing the scale changes almost the entire input set

CPM ranking
372.9median CPM
Shared
48 / 500genes
log₂-CPM ranking
15.9median CPM

The scale used before ranking variance changes almost the whole set of genes entering the analysis.

The variance declines without an obvious elbow

Scree plot showing individual and cumulative explained variance across 29 components.Scree plot showing individual and cumulative explained variance across 29 components.
Figure 2. Individual and cumulative explained variance for every component supported by the centred 30-sample matrix.
PC120.0%
PC1–PC230.0%
PC1–PC555.3%
PC1–PC1081%
Possible29 components

The same points reveal different structure

Colouring the projection by site produces substantial overlap. Connecting the three samples from each patient exposes a stronger patient-specific organisation.

The same PC1–PC2 scores shown by anatomical site and by patient.The same PC1–PC2 scores shown by anatomical site and by patient.
Figure 3. The same score coordinates viewed by anatomical site and patient. Lines show matching within patients, not trajectories.
FactorWithinBetweenRatio
Patient35.7056.601.585
Site54.9755.251.005

Within the global geometry represented by these distances, patient identity is the dominant organising factor.

Immunoglobulin genes dominate the extreme loadings

The twelve genes with the largest absolute PC1 loadings.The twelve genes with the largest absolute PC1 loadings.
Figure 4. The twelve largest absolute PC1 loadings; eight are immunoglobulin genes. Component sign is arbitrary, so magnitude—not left or right—is the stable feature.
Observed8 / 12

Eight of the twelve largest absolute loadings are immunoglobulin genes.

Possible explanations

Immune composition, immunoglobulin activity, repertoire differences or quantification behaviour.

Not established

Plasma-cell abundance or clonality cannot be inferred from these loadings alone.

The observed site statistic stays fixed; its reference changes

Same statisticF = 1.231 · R² = 0.084
Free permutationp = 0.1663

Site labels can move across all 30 samples.

Within-patient permutation0 / 9,999 ≥ observed

Site labels move only inside each matched triplet.

What this analysis establishes—and what it leaves open

Limitations

Thirty bulk, FFPE samples cannot resolve cell types. The non-omental category combines several intraperitoneal locations, and the first two PCs show only 30.0% of total variance.

External biological context

Compartment-resolved proteomics found patient-specific tumour signatures and site-associated stromal structure. This bulk analysis is consistent with that picture but cannot assign either effect to a compartment.

Eckert et al.

Reproducibility

The workflow pins dependencies, verifies source files, validates the PCA against scikit-learn and records two source-data defects without guessing ambiguous metadata.