Skip to content

About

Generalizable Python CLI utilities for bulk RNA-seq QC auditing, GENCODE biotype stratification, UCSC Xena Toil cohort subsetting, and publication summary tables.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Generalizable Python RNA-seq Pipeline Utilities

Python License: MIT

Modular, reproducible Python CLI tools designed for bulk RNA-seq data processing:

  • Pre- and post-trimming quality audit reporting from MultiQC JSON
  • Read synchronization and pair integrity validation
  • GENCODE annotation parsing and biotype composition analysis
  • Public cohort downloading and tissue-specific subsetting from UCSC Xena Toil
  • Publication-quality supplementary table generation

Repository Structure

.
├── 01_qc_and_trimming_audits/
│   ├── qc_audit.py                     # Pre-trimming FastQC metrics & flag reporter
│   ├── post_trim_qc_audit.py           # Post-trimming QC & read retention auditor
│   └── validate_pe.py                  # Paired-end FASTQ read integrity validator
├── 02_biotype_and_matrix_qc/
│   └── biotype_audit.py                # Reference biotype mapping & matrix stratification
├── 03_external_cohort_subsetting/
│   └── fetch_and_subset_xena_toil.py   # Multi-tissue UCSC Xena Toil cohort subsetter
├── 04_supplementary_table_builders/
│   ├── make_supp_table_s1.py           # Supplementary Table S1 builder (Pre-trim QC)
│   └── make_supp_table_s2.py           # Supplementary Table S2 builder (Post-trim QC)
├── requirements.txt                    # Python library dependencies
├── LICENSE                             # MIT License
└── README.md                           # Documentation and CLI usage guide

Installation & Setup

git clone https://github.com/Silico-Notes/python_scripts.git
cd python_scripts

# Optional: set up a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

CLI Usage Examples

1. Pre-Trimming QC Audit

Audit raw FastQC data from MultiQC outputs:

python3 01_qc_and_trimming_audits/qc_audit.py \
    --input ./results/01_multiqc_raw/multiqc_raw_report_data/multiqc_data.json \
    --table-format markdown

2. Post-Trimming QC Audit & Read Retention

Audit trimmed reads and calculate retention percentages:

python3 01_qc_and_trimming_audits/post_trim_qc_audit.py \
    --input ./results/02_multiqc_trimmed/multiqc_trimmed_report_data/multiqc_data.json \
    --raw-json ./results/01_multiqc_raw/multiqc_raw_report_data/multiqc_data.json

3. Paired-End FASTQ Read Integrity Validation

Verify pair synchronization between forward and reverse FASTQ files:

python3 01_qc_and_trimming_audits/validate_pe.py \
    ./data/SAMPLE_01_R1.fq.gz \
    ./data/SAMPLE_01_R2.fq.gz \
    --expected-pairs 25000000

4. Biotype Stratification & Count Matrix Audit

Map count matrices to GENCODE biotypes:

python3 02_biotype_and_matrix_qc/biotype_audit.py \
    --gtf ./reference/annotation.gtf \
    --counts ./results/stringtie_quant/matrices/gene_count_matrix.csv \
    --tpm ./results/stringtie_quant/matrices/gene_tpm_matrix.tsv \
    --metadata ./data/samplesheet.csv \
    --outdir ./results/pre_de_audit/tables

5. UCSC Xena Toil Multi-Cohort Subsetting

Download and subset TCGA + GTEx Toil matrices for any organ or tumor type:

python3 03_external_cohort_subsetting/fetch_and_subset_xena_toil.py \
    --cache-dir ./external_validation/tcga_gtex_toil \
    --primary-site Breast \
    --cancer-code BRCA

6. Supplementary Table Generation

Generate formatted CSV tables for publication:

# Pre-trimming QC summary
python3 04_supplementary_table_builders/make_supp_table_s1.py \
    --input ./results/01_multiqc_raw/multiqc_raw_report_data/multiqc_data.json \
    --output ./results/summary_tables/Supplementary_Table_S1_PreTrim_QC.csv

# Post-trimming QC summary
python3 04_supplementary_table_builders/make_supp_table_s2.py \
    --input ./results/02_multiqc_trimmed/multiqc_trimmed_report_data/multiqc_data.json \
    --output ./results/summary_tables/Supplementary_Table_S2_PostTrim_QC.csv

About

Generalizable Python CLI utilities for bulk RNA-seq QC auditing, GENCODE biotype stratification, UCSC Xena Toil cohort subsetting, and publication summary tables.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages