Colorectal cancer (CRC) arises from the accumulation of genetic and molecular changes in the cells lining the colon and rectum. Early detection dramatically improves outcomes, but current methods like colonoscopy are invasive, require bowel preparation, and carry procedural risks - barriers that reduce patient compliance with recommended screening schedules.
Stool samples offer a compelling non-invasive alternative. As cancer cells shed genetic material into the gut, stool naturally contains tumor-derived molecules including RNA transcripts that can reflect the molecular state of the colorectal lining. Analyzing these stool transcriptomes - the full collection of RNA molecules present in stool - provides a window into what is happening at the tissue level without any physical intervention.
The challenge is that stool contains a highly complex mixture of human, microbial, and environmental genetic material. Identifying the specific human cancer-related signals requires sophisticated computational approaches to separate meaningful patterns from background noise. This study applies machine learning combined with gene network analysis to meet that challenge.
The primary dataset used was GSE132236, a publicly available stool transcriptomic dataset containing 80 samples: 29 from CRC patients, 27 from patients with colorectal adenomas (precancerous growths), and 24 healthy controls. An external validation dataset, GSE99573, containing 338 stool RNA arrays measured on the Affymetrix HTA 2.0 platform, was used to test how well findings generalized beyond the original data.
Rigorous preprocessing was applied to remove technical artifacts. Reads with low quality scores (Phred score below 20) were discarded. Samples with fewer than 10 million mapped reads, duplication rates above 30%, or statistical outlier status were excluded. Only genes expressed at detectable levels in at least 70% of samples within each class were retained for analysis.
Because the two datasets were generated on different platforms and in different laboratories, batch effect correction using ComBat-seq was applied. Normalization used DESeq2 variance-stabilizing transformation, a standard method that accounts for sequencing depth differences between samples. These preprocessing steps are essential to ensure that biological differences - not technical artifacts - drive the findings.
Three distinct machine learning classifiers were trained to distinguish CRC from non-cancer samples: a Random Forest (RF), a linear Support Vector Machine (SVM), and a feed-forward deep neural network (multilayer perceptron, MLP). Using multiple model types provides robustness - if all three agree, the result is more trustworthy than any single approach.
Feature selection was performed within a nested cross-validation framework - a design that strictly separates the data used for feature selection, hyperparameter tuning, and final evaluation. This prevents information leakage, a common source of inflated performance estimates in machine learning studies. The data were split 70% for training, 15% for internal validation, and 15% for final testing.
Class imbalance - the fact that cancer cases were outnumbered by healthy controls - was addressed using class weighting, which prevents the model from being biased toward predicting the majority class. Model interpretability was assessed using permutation importance for the RF and SVM models and SHAP values for the deep learning model, providing gene-level explanations of why specific predictions were made.
The machine learning models achieved remarkable classification performance. The best model reached an AUROC of 0.9987 - meaning it correctly ranked essentially every CRC sample above every non-cancer sample. Sensitivity and specificity were both high, indicating the model rarely missed cancer cases or falsely alarmed healthy individuals.
Principal component analysis (PCA) of the stool transcriptomes revealed clear separation between groups in the data's underlying structure. PC1 (explaining 23.4% of variance) and PC2 (14.1%) separated CRC samples - which shifted positively along PC1, consistent with proliferative and inflammatory gene expression - from healthy controls, with adenoma patients falling in between, suggesting a detectable progression from normal to cancerous state.
Performance on the external validation dataset GSE99573 confirmed that the models generalized beyond the primary training cohort. Results were consistent with the internal validation, supporting the claim that the identified gene signatures reflect genuine disease biology rather than overfitting to a specific dataset's characteristics.
The most consistently important genes across all three classifiers and across 100 resampling runs were predominantly involved in cell cycle regulation. The top-ranked genes included CDKN2A, MKI67, TOP2A, CCNB1, MCM2, and PCNA - all of which are upregulated in CRC stool compared to healthy controls, with log2 fold-changes ranging from 1.3 to 2.1.
Among these, CDKN2A (also known as p16) was the highest-ranked feature, with a hazard ratio of 2.41 (95% CI: 1.65-3.52) in Cox survival analysis - meaning patients with high CDKN2A stool RNA expression had more than twice the risk of poor outcomes. MKI67 (Ki-67), a classic proliferation marker widely used in pathology, was also prominently featured, reinforcing the biological plausibility of the signature.
Important cancer-driver genes well-known from tumor tissue studies also appeared: KRAS, TP53, APC, and SMAD4 were all detectable in stool transcriptomes and ranked among informative predictors. The fact that these established CRC mutation hotspot genes also show transcriptional alterations detectable in stool lends biological credibility to the non-invasive approach.
Weighted Gene Co-expression Network Analysis (WGCNA) was applied to identify groups of genes that rise and fall together across samples - indicating that they are part of coordinated biological programs. The analysis identified 8 gene modules, each representing a distinct co-expressed cluster of genes with shared biological functions.
The most important module for cancer detection was Module M5, labeled the cell-cycle module. The top predictive genes - CDKN2A, MKI67, TOP2A, CCNB1, MCM2, PCNA - all mapped to this module with high module membership scores (kME) ranging from 0.81 to 0.88, confirming they are central hub genes in this network rather than peripheral members.
Other relevant modules included M2 (WNT/epithelial signaling, containing APC), M3 (DNA damage response, containing TP53), and M1 (inflammation, containing KRAS and CXCL8/IL-8). The network analysis thus not only identifies individual genes but also reveals the coordinated biological pathways that are disrupted in colorectal cancer and detectable through stool RNA profiling.
The ability to detect meaningful CRC-associated gene expression from stool samples opens significant possibilities for non-invasive population-level screening. Unlike colonoscopy, a stool-based RNA test could be performed at home, mailed to a laboratory, and repeated annually without any patient discomfort or procedural risk.
Beyond simple detection, the identified genes also carry prognostic value. Cox regression analysis showed that higher expression of CDKN2A (HR=2.41), MKI67 (HR=2.10), CCNB1 (HR=2.05), and MCM2 (HR=1.95) in stool RNA were all significantly associated with worse patient outcomes. This raises the prospect that stool transcriptomics could stratify patients by disease aggressiveness, informing how urgently they need intervention.
The inclusion of adenoma samples - representing a precancerous stage - also provides a view into disease progression. Adenoma samples occupied an intermediate position between healthy and CRC in both the PCA space and the gene expression profiles, suggesting that the biomarker panel might detect early-stage disease or even precancerous lesions, which would have major implications for cancer prevention.
This study demonstrates that a machine learning analysis of stool RNA transcriptomes can detect colorectal cancer with very high accuracy, achieving an AUROC of 0.9987. The approach identifies a biologically coherent set of biomarker genes centered on cell-cycle dysregulation - a hallmark of cancer - that are detectable outside the body without tissue sampling.
The convergence of three independent machine learning approaches (RF, SVM, MLP) on the same set of top genes, combined with their concordance with WGCNA network hubs, provides strong evidence that these markers are capturing genuine disease biology. Feature stability across 100 resamples (92% for CDKN2A, 90% for MKI67) further confirms robustness.
Future work should include larger prospective clinical cohorts, validation in diverse ethnic populations, and the development of practical stool RNA collection and stabilization protocols suitable for routine clinical use. If these steps are completed, stool transcriptomics-based ML diagnostics could become a powerful tool for colorectal cancer prevention at a population scale, potentially reducing mortality through earlier intervention.