Case study 04 · 2025

Batch Effects in Cancer Genomics

A research project asking whether a model predicting tumor subtype from gene expression learns biology - or merely the hospital that produced the sample.

Scroll to explore
Role
Individual research project
Field
Bioinformatics · Machine learning · Research
Cancer cell and DNA strand in warm coral tones
TCGA-BRCADataset
16LOBO folds
144Experiments
01

The question

RNA-seq data is produced across different hospitals, machines, dates, and protocols. Those technical differences leave fingerprints unrelated to biology. A model can quietly learn the batch, score beautifully on familiar data, and collapse on samples from a new institution. I set out to measure how much these effects distort breast-cancer subtype prediction - and whether standard corrections fix the problem or merely hide it.

02

What I did

I worked with TCGA-BRCA, retaining 842 tumors and the 5,000 most variable genes after filtering and variance stabilization. The task was to predict five PAM50 molecular subtypes, judged with macro-F1 and balanced accuracy because the classes are uneven.

The core design was leave-one-batch-out cross-validation: hold out an entire institution, train on the other fifteen, and always evaluate on an unseen source. Across 16 institutions, I compared an uncorrected baseline, ComBat-seq, and per-batch mean-centering with logistic regression, random forest, and SVM - 144 experiments in total. PCA, ANOVA, Wilcoxon signed-rank tests, Kruskal-Wallis, and Spearman tests completed the analysis.

03

What I found

The headline result contradicted my expectation: biology dominated. Subtype explained roughly 22 times more variation in the leading principal component than institution did - an R² near 0.75 versus 0.03. Batch effects were real, but they were not the principal structure in the data.

Correction’s value appeared in consistency rather than average performance. Uncorrected macro-F1 varied by around 0.50 across held-out hospitals; ComBat-seq roughly halved that spread for logistic regression, down to about 0.23, while sacrificing only a few average F1 points. It traded a little headline accuracy for much steadier cross-hospital behavior.

04

What I took from it

I expected the project to confirm a clear hypothesis, but the data told a more complicated story. Learning to accept that, investigate what was actually happening, and report it honestly was one of the most valuable parts of the work. It reminded me that good research is not about being right at the beginning - it is about staying curious and being rigorous enough to change your mind.