Skip to main content

Pan-cancer biomarker discovery from the command line

Project description

oncofind ๐Ÿ”ฌ

Pan-cancer biomarker discovery from the command line.
Integrates TCGA RNA-seq, clinical data, survival endpoints, and external validation into a reproducible, publication-ready pipeline.

Tests Python TCGA COSMIC License


What it does

oncofind downloads real TCGA RNA-seq data from the NIH Genomic Data Commons, runs differential expression, Kaplan-Meier survival analysis, and cross-cancer consistency scoring โ€” then validates ranked biomarker candidates against the COSMIC Cancer Gene Census.

In one command chain:

oncofind download --cancer BRCA --n-samples 100
oncofind deg --cancer BRCA --groupby stage
oncofind survival --cancer BRCA --gene TP53
oncofind score --cancers BRCA --top-n 200
oncofind validate --cccs-csv oncofind_results/pancancer_cccs_rankings.csv \
                  --cosmic-csv cosmic_census.csv --gene-col Gene --score-col CCCS

Architecture

GDC API (TCGA)
     โ”‚
     โ–ผ
GDCClient โ”€โ”€โ–บ ExpressionStore (Parquet)
     โ”‚              โ”‚
     โ–ผ              โ–ผ
ClinicalStore โ”€โ”€โ–บ DEGAnalyzer โ”€โ”€โ–บ volcano.html / heatmap.html
(survival_days,        โ”‚
 sample_type,          โ–ผ
 ER/PR/HER2)    SurvivalAnalyzer โ”€โ”€โ–บ KM plot .html
                       โ”‚
                       โ–ผ
               CrossCancerConsistencyScorer (CCCS)
                       โ”‚
                       โ–ผ
               CosmicBenchmark (Precision@K vs CGC Tier 1)
                       โ”‚
                       โ–ผ
               ReportGenerator โ”€โ”€โ–บ report_BRCA.html

Key modules

Module Purpose
oncofind/core/data/gdc_client.py Async GDC API client (queries + parallel downloads)
oncofind/core/data/expression_store.py Parquet expression matrix storage + DuckDB queries
oncofind/core/data/clinical_store.py Clinical metadata: survival, subtype, sample_type
oncofind/core/data/dgidb_client.py DGIdb drug-gene interaction API (700+ targets, cached)
oncofind/core/analysis/deg.py DEG: PyDESeq2 + t-test fallback, tumor-vs-normal mode
oncofind/core/analysis/survival.py Kaplan-Meier + log-rank (lifelines)
oncofind/core/analysis/cccs.py Cross-Cancer Consistency Score
oncofind/core/analysis/batch.py ComBat batch correction for multi-cohort analysis
oncofind/core/validation/cosmic_benchmark.py Precision@K vs COSMIC Cancer Gene Census
oncofind/cli/utils/manifest.py JSON run manifests for reproducibility
scripts/weight_sensitivity.py CCCS rank stability (Kendall-ฯ„)

Installation

git clone https://github.com/sanjeevi0078/oncofind
cd oncofind
pip install -e .

Requirements: Python 3.10+, ~2GB disk space per cancer type.


Quickstart

1. Download real TCGA data

# 97โ€“100 BRCA RNA-seq + clinical samples (~400MB, ~6 min)
oncofind download --cancer BRCA --n-samples 100

# Multiple cancers for pan-cancer analysis
oncofind download --cancer LUAD --n-samples 50
oncofind download --cancer COAD --n-samples 50

2. Differential expression

# Clinical subgroup comparison
oncofind deg --cancer BRCA --groupby stage --method ttest

# Tumor vs Normal (uses GDC sample_type field)
oncofind deg --cancer BRCA --mode tumor_vs_normal --method deseq2

Outputs: volcano_BRCA.html, heatmap_BRCA.html, BRCA_deg_results.csv

3. Survival analysis

oncofind survival --cancer BRCA --gene TP53
oncofind survival --cancer BRCA --gene ESR1
oncofind survival --cancer BRCA --gene ERBB2

Outputs: BRCA_TP53_survival.html (Kaplan-Meier), BRCA_TP53_survival_groups.csv

4. Pan-cancer scoring (CCCS)

# Single cancer
oncofind score --cancers BRCA --top-n 200

# Multi-cancer with ComBat batch correction
oncofind pancancer --gene TP53 --cancers BRCA LUAD COAD --batch-correct

5. COSMIC validation

# Download COSMIC CGC CSV from cancer.sanger.ac.uk/census (free registration)
oncofind validate \
  --cccs-csv oncofind_results/pancancer_cccs_rankings.csv \
  --cosmic-csv cosmic_census.csv \
  --gene-col Gene --score-col CCCS \
  --ks 10,20,50,100

6. Rank stability analysis

python scripts/weight_sensitivity.py \
  --cccs-csv oncofind_results/pancancer_cccs_rankings.csv

Reports Kendall-ฯ„ rank correlation across 5 CCCS weight configurations.

7. Full report

oncofind report --cancer BRCA --output-dir oncofind_results/

TCGA Data Access (GDC API)

All data is fetched from the NIH Genomic Data Commons public API โ€” no account required for open-access data.

# Under the hood: GDCClient queries the GDC Files endpoint
# and downloads STAR-Counts RNA-seq files (augmented_star_gene_counts format)
GET https://api.gdc.cancer.gov/files?...
GET https://api.gdc.cancer.gov/data/{file_id}
GET https://api.gdc.cancer.gov/cases?...  # clinical

Is the GDC API free and reliable?
Yes, for open-access TCGA data (most RNA-seq). Rate limited to ~10 concurrent connections. The client uses an asyncio semaphore (max 5 concurrent) and aiter_bytes streaming to handle large files (4โ€“8 MB each). Failed downloads are logged and retried on next run (cached by file path).


The CCCS Metric

The Cross-Cancer Consistency Score (0โ€“1) rewards genes that are:

  1. Consistent in direction across multiple cancer types (all up or all down)
  2. High in fold change magnitude (|log2FC|)
  3. Associated with survival when split by expression
  4. Highly statistically significant (small adjusted p-value)
CCCS = w1ยทS_dir + w2ยทS_mag + w3ยทS_surv + w4ยทS_sig

Default weights: {"direction": 0.25, "magnitude": 0.25, "survival": 0.35, "significance": 0.15}

External validation

Ranked gene lists are benchmarked against COSMIC Cancer Gene Census Tier 1 (572 manually curated cancer driver genes):

Precision@K = |top_K โˆฉ COSMIC_Tier1| / K

A P@50 > 50% means the majority of your top-50 candidates are confirmed cancer drivers.


Reproducibility

Every CLI command writes a {command}_manifest.json alongside results:

{
  "oncofind_version": "0.1.0",
  "command": "deg",
  "timestamp_utc": "2026-05-29T16:52:00Z",
  "parameters": {
    "cancer": "BRCA", "mode": "subtype_comparison",
    "groupby": "stage", "method": "ttest",
    "fdr": 0.05, "log2fc": 1.0
  },
  "input_data_hashes": {
    "expression_matrix.parquet": "a3f7c2..."
  },
  "result_summary": {
    "n_genes_tested": 60241,
    "n_significant": 1847,
    "n_up": 923, "n_down": 924,
    "top_gene": "TP53"
  }
}

CLI Reference

oncofind --help

Commands:
  download    Download TCGA RNA-seq + clinical data from GDC
  deg         Differential expression (PyDESeq2 or t-test, tumor vs normal)
  survival    Kaplan-Meier + log-rank survival analysis
  pancancer   Cross-cancer gene consistency with ComBat batch correction
  score       Rank all genes by CCCS
  validate    Benchmark against COSMIC Cancer Gene Census (Precision@K)
  report      Full HTML report for a cancer type
oncofind download --cancer BRCA --n-samples 100
oncofind deg      --cancer BRCA --mode tumor_vs_normal --method deseq2
oncofind survival --cancer BRCA --gene TP53 --split tercile
oncofind pancancer --gene TP53 --cancers BRCA LUAD COAD --batch-correct
oncofind score    --cancers BRCA LUAD COAD --top-n 200 --druggable-only
oncofind validate --cccs-csv rankings.csv --cosmic-csv census.csv --gene-col Gene --score-col CCCS
oncofind report   --cancer BRCA --output-dir results/

Project Structure

oncofind/
โ”œโ”€โ”€ oncofind/
โ”‚   โ”œโ”€โ”€ cli/
โ”‚   โ”‚   โ”œโ”€โ”€ commands/          # CLI commands (deg, survival, score, ...)
โ”‚   โ”‚   โ””โ”€โ”€ utils/
โ”‚   โ”‚       โ”œโ”€โ”€ manifest.py    # Run manifest / audit trail
โ”‚   โ”‚       โ””โ”€โ”€ validators.py  # Input validation
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ druggability.py    # DGIdb facade
โ”‚   โ”‚   โ””โ”€โ”€ settings.py
โ”‚   โ””โ”€โ”€ core/
โ”‚       โ”œโ”€โ”€ analysis/
โ”‚       โ”‚   โ”œโ”€โ”€ batch.py       # ComBat batch correction
โ”‚       โ”‚   โ”œโ”€โ”€ cccs.py        # Cross-cancer consistency score
โ”‚       โ”‚   โ”œโ”€โ”€ deg.py         # Differential expression
โ”‚       โ”‚   โ””โ”€โ”€ survival.py    # Kaplan-Meier
โ”‚       โ”œโ”€โ”€ data/
โ”‚       โ”‚   โ”œโ”€โ”€ clinical_store.py
โ”‚       โ”‚   โ”œโ”€โ”€ dgidb_client.py
โ”‚       โ”‚   โ”œโ”€โ”€ expression_store.py
โ”‚       โ”‚   โ””โ”€โ”€ gdc_client.py
โ”‚       โ”œโ”€โ”€ validation/
โ”‚       โ”‚   โ””โ”€โ”€ cosmic_benchmark.py
โ”‚       โ””โ”€โ”€ visualization/
โ”‚           โ”œโ”€โ”€ heatmap.py
โ”‚           โ”œโ”€โ”€ pancancer_plot.py
โ”‚           โ”œโ”€โ”€ survival_plot.py
โ”‚           โ””โ”€โ”€ volcano.py
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ run_full_pipeline.py   # End-to-end pipeline runner
โ”‚   โ””โ”€โ”€ weight_sensitivity.py  # CCCS rank stability (Kendall-ฯ„)
โ”œโ”€โ”€ tests/                     # 21 unit tests
โ””โ”€โ”€ cosmic_census.csv          # COSMIC CGC Tier 1 gene list

Methods, Limitations, and Validation Discussion

The CCCS Scoring System

The Cross-Cancer Consistency Score (CCCS) is a unified heuristic designed to identify robust transcriptomic biomarkers. It integrates four orthogonal signals:

  1. Directional Consistency (25%): Rewards genes whose expression changes concordantly (either universally upregulated or universally downregulated) across multiple cohorts.
  2. Magnitude (25%): Rewards genes with large absolute log2 fold-changes.
  3. Clinical Association (35%): Rewards genes where expression splits (e.g., median or quartile) are significantly associated with overall survival via log-rank tests.
  4. Statistical Significance (15%): Rewards genes with small adjusted p-values.

Covariate Control and Batch Standardization

To prevent false discoveries arising from clinical confounding and technical batch effects:

  • Location-Scale Batch Standardization: Multi-cohort data is standardized within each cohort by centering and scaling (centering by the mean and dividing by the standard deviation of each batch). This mitigates technical batch differences without the risk of over-fitting associated with small-sample empirical Bayes models.
  • Covariate-Adjusted OLS Regression: The differential expression fallback method employs ordinary least squares (OLS) regression (gene ~ group + age + sex) rather than simple t-tests to control for age and gender covariates, ensuring observed differences are driven by disease state rather than demographic confounding.

COSMIC CGC Validation and Biological Limitations

Benchmarking oncofind rankings against the COSMIC Cancer Gene Census (CGC) Tier 1 yields a low precision (e.g., ~1% for top-100 candidates). This is a known biological limitation of expression-based biomarker pipelines:

  • Expression vs. Mutation: COSMIC CGC is curated primarily from genes carrying somatic driver mutations (e.g., TP53, PIK3CA, PTEN, AKT1). The activity of these mutated proteins is often regulated post-translationally (e.g., phosphorylation, conformational changes) rather than by massive changes in mRNA expression.
  • Downstream Effectors: Differential expression between tumor and normal tissue primarily identifies cell-cycle, proliferation, and microenvironment-remodeling markers (e.g., MMP11, NEK2, KIF20A, ZWINT, UHRF1). While these genes are highly dynamic and strong prognostic factors (thus receiving high CCCS scores), they are downstream effectors rather than primary mutation-based drivers, and are therefore excluded from the COSMIC CGC census.
  • Methodological Recommendation: For general cancer driver identification, integrate transcriptomic profiling with somatic mutation (SNV/Indel) and copy number variation (CNV) data.

License

MIT License โ€” see LICENSE.

Citation

If you use oncofind in research, please cite:

Sanjeevi Utchav. oncofind: Pan-cancer biomarker discovery pipeline. 2026.
GitHub: https://github.com/sanjeevi0078/oncofind

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oncofind-0.1.0.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oncofind-0.1.0-py3-none-any.whl (84.2 kB view details)

Uploaded Python 3

File details

Details for the file oncofind-0.1.0.tar.gz.

File metadata

  • Download URL: oncofind-0.1.0.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oncofind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e14c57795a5a61d1c2e58039ef7a669cf4185901a4a8e2d47d44edd7c1343edc
MD5 727d36ce504971fe75e853cc9dc37ed1
BLAKE2b-256 4d46ef3bc6dac0415ac879243f54d73b5202d9c33483a83341e2739d615c3010

See more details on using hashes here.

Provenance

The following attestation bundles were made for oncofind-0.1.0.tar.gz:

Publisher: publish.yml on sanjeevi0078/oncofind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oncofind-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oncofind-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 84.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oncofind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7159f58c9e1cba4bddefebe9e0e12e276effcf4dcecfa93119e66f3a09750d26
MD5 8d481dbc6176175e04c0e3ce86bc470d
BLAKE2b-256 69dbb606fdc8bc195cc2e9127f83230665255c3278084d5a4a4f36146281647b

See more details on using hashes here.

Provenance

The following attestation bundles were made for oncofind-0.1.0-py3-none-any.whl:

Publisher: publish.yml on sanjeevi0078/oncofind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page