This project is an end-to-end Python pipeline for differential expression analysis on a real public breast cancer bulk RNA-seq cohort.
It retrieves open-access RNA-seq count data from the Genomic Data Commons for the TCGA-BRCA cohort, builds a gene-level count matrix, performs tumor-versus-normal differential expression analysis, and generates output tables, visualizations, and a summary report.
The goal of this project was to build a complete and reproducible transcriptomics workflow using a real cancer dataset rather than a toy example. The pipeline is designed to cover the main stages of a practical analysis workflow, from data retrieval to interpretable outputs.
The analysis includes:
- cohort discovery through the GDC API
- download and parsing of raw count files
- construction of a gene-level count matrix
- low-expression filtering
- CPM and log2-CPM normalization
- tumor-versus-normal differential expression testing
- Benjamini-Hochberg multiple testing correction
- generation of result tables, PCA, volcano plot, heatmap, and summary report
This pipeline uses the public TCGA-BRCA breast cancer RNA-seq cohort from the Genomic Data Commons. The project is framed around a CPTAC breast cancer analysis use case, while keeping the RNA-seq source fully public and reproducible.
.
├── run_pipeline.py
├── requirements.txt
├── pyproject.toml
├── src/cptac_brca_pipeline/
│ ├── analysis.py
│ ├── gdc.py
│ └── pipeline.py
└── tests/
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 run_pipeline.pyThe default configuration runs on a smaller real-data subset of 5 tumor and 5 normal samples so the pipeline can complete reliably on a typical laptop.
To run a larger subset:
python3 run_pipeline.py --max-tumor-samples 25 --max-normal-samples 25After a successful run, the pipeline writes:
output/processed/sample_metadata.tsvoutput/processed/raw_count_matrix.tsvoutput/processed/log2_cpm_matrix.tsvoutput/processed/differential_expression_results.tsvoutput/processed/significant_genes.tsvoutput/figures/volcano_plot.pngoutput/figures/pca_plot.pngoutput/figures/top_genes_heatmap.pngoutput/reports/analysis_summary.md
In a successful starter run on a real subset, the pipeline produced:
- 5 tumor samples and 5 normal samples
- more than 24,000 genes retained after filtering
- more than 1,000 significant genes at
FDR <= 0.05and|log2FC| >= 1
Representative genes from the output included:
- Upregulated:
COL10A1,COL11A1,MMP11,COMP - Downregulated:
LEP,FABP4,ADIPOQ,PLIN1
Gene expression values are parsed from public RNA-seq count files and assembled into a sample-by-gene matrix. Low-expression genes are removed prior to analysis. Counts are normalized to counts per million and log2-transformed. Differential expression is then computed between tumor and normal groups using Welch's t-test, followed by Benjamini-Hochberg correction to control the false discovery rate.
This implementation is intentionally lightweight and transparent, with the goal of making each step of the workflow easy to inspect and extend.
- Python
- pandas
- numpy
- scipy
- matplotlib
- seaborn
python3 -m unittest discover -s tests -vMIT License. See LICENSE.