Analysis code for a study of RNA-seq–based differential expression (DE) and machine-learning (ML) classification of Parkinson's disease (PD) case/control status using data from the AMP-PD (Accelerating Medicines Partnership – Parkinson's Disease) cohorts PPMI and PDBP/BioFIND (PDBF).
The pipeline in this repository:
- Filters and prepares AMP-PD RNA-seq quantification and clinical/genetic
data for case/control and mutation-carrier comparisons (
DE/src/filtration.py,DE/src/extract_quant.py). - Runs differential expression analysis with DESeq2 on gene-level,
eRNA, and circRNA quantifications, adjusting for covariates (age, sex,
plate, RIN, genotype PCs) (
DE/src/DE_PCs.R,DE/src/eRNA/DE_eRNA.R,DE/src/circRNA/DE_circRNA.R). - Performs functional enrichment (GO/KEGG/Reactome/GSEA) on DE results
(
DE/src/Enrich_Profiler.R). - Trains and evaluates ML classifiers (logistic regression, LASSO, SVM,
random forest, XGBoost, KNN, MLP, etc.) that predict case/control status
from DE genes, eRNAs, circRNAs, clinical variables, and polygenic risk
scores (PRS), with PPMI used for training and PDBF used as an independent
test/replication set (
ML/src/*.py). - Summarizes model performance with AUROC/PR curves and feature-importance
plots (
ML/src/31_plots_AUC_PR_inOne.py). - Also includes a standalone NanoString endogenous/housekeeping gene QC
script (
DE/NanoStringData/NanoString-AllControl-Boxplot.R).
Input data: gene/eRNA/circRNA read-count and TPM matrices, sample
covariate tables (*_cov_with_PCs.tsv), and AMP-PD clinical CSVs
(demographics, UPDRS, MMSE, participant mutation status). Example
covariate/feature tables used by the ML scripts are provided under
AI2AMP-PD_Datasets/ in the parent directory (PPMI_PDBP/, ML/).
Outputs: DESeq2 result tables (DEresult*.xls), volcano/diagnostic
plots, enrichment tables and plots, per-model prediction tables and
AUROC/PR plots, and feature-importance/coefficient tables — all written
under each module's results/ directory.
cd AI2AMP-PD/DE/src
Rscript DE_PCs.R RNA_expr_matrix_tpm.txt RNA_expr_matrix_reads.txt sample_covariates_with_PCs.tsv PDBF_CaseA_CtrlA
# Output: ../results/PDBF_CaseA_CtrlA_PCs/DE/cd AI2AMP-PD/DE/src/eRNA
Rscript DE_eRNA.R # edit prefix / expr_file_cts at top of script
cd AI2AMP-PD/DE/src/circRNA
Rscript DE_circRNA.R PDBF_all_samples merge.exon.allSamples.PDBF.circRNArawcount.wide.txtcd AI2AMP-PD/DE/src
Rscript Enrich_Profiler.R # edit the `prefix` variable to match a DE results folder
# Output: ../results/<prefix>/Enrich_profiler/cd AI2AMP-PD/ML/src
python 20_Classifers_DT_SVM.py DT mm # feature_selection, scale_method
python 11_Classifers_LASSO.py # LASSO feature-selection pathway
python 11_Classifers_LASSO_stepped.py
python 11_Classifers_Genes_clinical_PRS_stepadd.py DT logz DEG
python 31_plots_AUC_PR_inOne.py # combined AUROC/PR summary plotsEach ML script trains on PPMI (data/PPMIvst_DEG_eRNA_circRNA_Clinical_PRS.tsv)
and evaluates on held-out PPMI samples plus the independent PDBF cohort
(data/PDBFvst_DEG_eRNA_circRNA_Clinical_PRS.tsv), writing per-model
train/val/test prediction tables and ROC/PR plots to ../results/.
TIP: The AMP-PD clinical and genetic data used here contain protected health information and are not included in this repository. Access is requested through the AMP-PD Knowledge Portal. Substitute your own similarly-formatted matrices/covariate tables to run the pipeline end to end.
Figure/plot generation is embedded in the DE and ML analysis scripts above
rather than kept in separate figure-only scripts — running an analysis
script produces its associated plots as a side effect, written under that
module's results/ directory.
| Script | Plots produced | Output |
|---|---|---|
DE/src/DE_PCs.R |
Data-diagnosis plots, sample-distance clustering tree, PCA plots, MA plots, volcano plots (EnhancedVolcano), top-DE-gene heatmaps |
data_diagnosis.pdf, clustering.tree.pdf, DEresult.padj_05_volcano.pdf, DEresult.padj_05.heatmap.pdf in ../results/<prefix>/DE/ |
DE/src/eRNA/DE_eRNA.R |
Same plot types as DE_PCs.R, for eRNA quantifications |
../results/<prefix>/DE/ |
DE/src/circRNA/DE_circRNA.R |
Data-diagnosis, MA, volcano, and top-DE heatmap plots for circRNA quantifications | ../results/<prefix>/DE/ |
DE/src/Enrich_Profiler.R |
GO/KEGG/Reactome/GSEA enrichment bar plots | Enrich.pdf in ../results/<prefix>/Enrich_profiler/ |
DE/NanoStringData/NanoString-AllControl-Boxplot.R |
Boxplots of NanoString endogenous/housekeeping control probes (QC/validation) | DE/NanoStringData/results/ |
ML/src/20_Classifers_DT_SVM.py |
Prediction-distribution plots, per-model train/val/test AUROC and PR curves | *_prediction_distribution.pdf, Train_Val_AUROC_PR_<model>.pdf, Test_AUROC_PR_<model>.pdf in ../results/ |
ML/src/11_Classifers_LASSO.py |
LASSO coefficient-vs-alpha and performance-vs-alpha (AUC/accuracy) plots | coefficients_alpha*.pdf, alpha_performances_*.pdf in ../results/ |
ML/src/11_Classifers_LASSO_summary.py |
Best-alpha, feature-count-vs-alpha, and max-correlation-vs-alpha summary plots | best_alpha_loop_LN.pdf, feature_count_alpha_loop_LN_*.pdf, max_corr_alpha_loop_LN.pdf in ../results/ |
ML/src/11_Classifers_Genes_clinical_PRS_stepadd.py |
Same prediction-distribution and AUROC/PR plots as 20_Classifers_DT_SVM.py, for the stepwise gene/clinical/PRS feature-addition models |
../results/ |
ML/src/31_plots_AUC_PR_inOne.py |
Combined AUROC and PR curves across all models/cohorts, top-20 feature-importance bar plot | AUROC_merged.pdf, PRC_merged.pdf, Top20_feature_importance_bar_Symbol.pdf in ../results/ |
Run the corresponding script from its src/ directory (see
Documentation and Working Example
above) to regenerate its plots; no separate make-figures step is needed.
- OS: Developed and tested on Linux/macOS; R and Python scripts have no OS-specific dependencies.
- R (≥ 4.0):
tidyverse,RCurl,hexbin,pheatmap,RColorBrewer,hwriter,vsn,DESeq2,ReportingTools,BiocParallel,limma,EnhancedVolcano,ggplot2,clusterProfiler,biomaRt,KEGG.db,ReactomePA,DOSE,org.Hs.eg.db,genefilter,GO.db,topGO,dplyr,gage,ggsci,enrichplot,fgsea,httr. - Python (≥ 3.8):
pandas,numpy,scikit-learn,matplotlib,seaborn. - No other versions have been tested.
Recorded computational environment: see session_info/ for the exact R
session info (R_sessionInfo.md), Python session info
(python_sessionInfo.md), and pinned Python dependencies
(requirements.txt) needed to recreate the environment the code was run
in. (These currently contain placeholders pending capture of the original
run's sessionInfo() / pip freeze output — see that folder for
instructions to regenerate them.)
git clone <this-repository-url>
cd AI2AMP-PD
# R dependencies (auto-installed on first run of DE_PCs.R; for the others, install manually)
Rscript -e 'install.packages(c("tidyverse","RCurl","hexbin","pheatmap","RColorBrewer","hwriter")); \
if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager"); \
BiocManager::install(c("vsn","DESeq2","ReportingTools","BiocParallel","limma","EnhancedVolcano", \
"clusterProfiler","biomaRt","KEGG.db","ReactomePA","DOSE","org.Hs.eg.db", \
"GO.db","topGO","gage","enrichplot","fgsea"))'
# Python dependencies
pip install pandas numpy scikit-learn matplotlib seabornAI2AMP-PD/
├── DE/ # Differential expression analysis
│ ├── src/
│ │ ├── filtration.py # Build case/control & mutation-carrier sample sets from clinical/genetic data
│ │ ├── extract_quant.py # Extract per-cohort RNA-seq quantification matrices
│ │ ├── DE_PCs.R # DESeq2 DE analysis for genes, adjusted for covariates/genotype PCs
│ │ ├── Enrich_Profiler.R # GO/KEGG/Reactome/GSEA enrichment on DE results
│ │ ├── eRNA/DE_eRNA.R # DESeq2 DE analysis for eRNAs
│ │ └── circRNA/DE_circRNA.R # DESeq2 DE analysis for circRNAs
│ ├── NanoStringData/ # NanoString validation data and QC boxplot script
│ └── results/ # DE tables, volcano/diagnostic plots, enrichment outputs (generated)
├── ML/ # Machine-learning classification
│ ├── src/
│ │ ├── 11_Classifers_LASSO*.py # LASSO-based feature selection & classification
│ │ ├── 11_Classifers_Genes_clinical_PRS_stepadd.py # Stepwise addition of gene/clinical/PRS features
│ │ ├── 20_Classifers_DT_SVM.py # Multi-model classification (SVM, RF, XGB, KNN, MLP, etc.)
│ │ └── 31_plots_AUC_PR_inOne.py # Combined AUROC/PR summary plots
│ └── results/ # Per-model prediction tables, AUROC/PR plots, feature-importance tables (generated)
├── session_info/ # R/Python session info & dependency versions for reproducing the environment
└── .gitignore
File naming convention: result folders are named <Cohort>_<Comparison>_<covariates>
(e.g. PDBF_CaseA_CtrlA_PCs, PPMI_all_samples_circRNAexon); Case/Ctrl
refer to PD case vs. control status, and suffixes such as _PCs, _eRNA_Class1,
or _circRNAexon indicate the covariate set or feature type used.
- Scripts were written for the specific AMP-PD sample sets and covariate
schemas used in this study (e.g.,
case_control_other_latest, genotype PC1–PC10) and are not general-purpose tools; column names in input files must match what each script expects. - File paths and cohort-specific parameters (
prefix,expr_file_cts, etc.) are set as literals orcommandArgs/sys.argvinputs at the top of each script and may need to be edited directly for new datasets. - Raw AMP-PD data are not distributed with this repository; the pipeline cannot be run end-to-end without independently obtained access.
This code accompanies the manuscript:
Hu R, Dong X, et al., "Differential expression and machine-learning classification of Parkinson's disease using AMP-PD RNA-seq data" (see
revision_R1/for the manuscript and reporting materials).Principal Investigator: Xianjun Dong, PhD (xianjun.dong@yale.edu)
Please cite the associated publication when using this code.
This project is licensed under the MIT License — see LICENSE.txt for
details.
Data were derived from the AMP PD Knowledge Platform. Funded by Aligning Science Across Parkinson's (ASAP) and the Michael J. Fox Foundation for Parkinson's Research (MJFF).