This repository contains the software code for the pharmacogenomics (PGx) study in the DKFZ/NCT/DKTK MASTER cohort - a joint project between IKP Stuttgart and NCT/DKFZ Heidelberg.
This is an R data-analysis project, not a software package. The scripts in this repository are intended to facilitate traceability and reproduction of the manuscript's results, figures and tables from the underlying multi-omics data.
To protect patient privacy, patient-level data is not released publicly but can be requested via GHGA and DKFZ. Publicly, every analysis in this repository can be read and its logic verified against the precomputed results it already produced; running it end-to-end on real patient data, however, requires the access described below.
-
R >= 4.4.3. Dependencies are pinned via
renv(renv.lock);.Rprofileactivates it automatically. Restore the exact package versions withrenv::restore(). -
Recommended: use the container instead of a bare
renv::restore()- several dependencies are Bioconductor packages with system-library requirements that are easy to get wrong on a fresh machine. Build it yourself from the provided Dockerfile (no registry, nothing to pull):docker build -t pgx_master .On the DKFZ cluster (or any other LSF site), convert it to a Singularity/ Apptainer image once:
apptainer build pgx_master.sif docker-daemon://pgx_master:latest
To run the whole project from inside the container with nothing else installed on your machine:
docker run --rm -v $(pwd):/project -w /project pgx_master \ Rscript run_analysis_and_figures.R -
Orchestration is environment-aware (
scripts/00_setup/orchestration.R,run_step()): it submits to LSF via thebsubpackage ifbsubis onPATH(falling back to the rawbsubCLI if that package misbehaves), wraps each step in Apptainer/Singularity/Docker depending on what's available, and just runs things locally/sequentially otherwise. The same scripts work on the DKFZ cluster, another institution's LSF cluster, or a laptop with only Docker. -
ANNOVAR (used for additional-variant annotation,
scripts/02_from_pseudonymized_data/08_annotate_additional_variants.R) has its own license and is not distributed with this repo or the container. Download it yourself (free registration required) from http://www.openbioinformatics.org/annovar/annovar_download_form.php and setANNOVAR_DIRinconfig.envto point at it. ANNOVAR itself needs Perl, which is already installed in the container image (unlike ANNOVAR, Perl has no redistribution restriction) - outside the container, on a module-based cluster without a system Perl onPATH, the script best-effort loads one viamodule loadif available. -
COSMIC Cancer Gene Census has its own redistribution license and is not included - download it from https://cancer.sanger.ac.uk/census (registration required). Two scripts each need their own export of it, in different column layouts, so they don't share one file:
05_analyse_somatic_CNAs.R(the oncogene/TSG cross-reference behind the Figure 3B-G ideograms) needs the v102/GRCh37 export atdata/Cosmic_CancerGeneCensus_v102_GRCh37.tsv.11_prepare_cancer_gc_genes.R(the ONC/TSG co-affected-gene counts behind Figure 3A/Table S5) needs aGene Symbol/Role in Cancerexport (accessed 5 July 2024 for the published numbers) atdata/metadata/CancerGeneCensus_all.tsv.
-
AlphaMissense pathogenicity scores (used in
09_additional_variants_functional_prediction.Rto enrich the APF/ANNOVAR variant annotations) are not included - downloadAlphaMissense_hg19.tsv.gzfrom https://storage.googleapis.com/dm_alphamissense/AlphaMissense_hg19.tsv.gz (retrieved 11 March 2025 for the published results), gunzip it, and place it atdata/additional_variants/alpha_missense/AlphaMissense_hg19.tsv. -
TCGA pan-cancer expression data (used in
06_analyse_expression_landscape.Rfor the tissue-of-origin validation) is not included - place an 18-cohort FPKM-UQ expression matrix (downloaded via TCGAbiolinks from https://gdc.cancer.gov/, accessed 12 January 2017 for the published results) atdata/TCGA/TCGA_18cohorts_FPKM_UQ.RDataand the matching cohort-abbreviation table atdata/TCGA/tcga.csv. -
gnomAD population-variant exports (used in
03_analyse_additional_germline_small_variants.Rfor the dN/dS-vs-population comparison, Figure 1C) are not included - export per-gene variant tables (withVEP Annotation/ClinVar Germline Classificationcolumns) from the gnomAD browser for the 60-gene panel and place them asdata/additional_variants/gnomAD/<gene>.csv. -
config.envholds the paths this repo's scripts need set (currently justANNOVAR_DIR) - fill it in before runningrun_stage1_from_pseudonymized_data.R.
Two ways to actually reproduce something from this repository, from the least to the most restricted:
| Starting point | Who this is | What it reproduces |
|---|---|---|
| From GHGA / DKFZ-provided data | A partner with a DKFZ data-sharing agreement | All per-patient Stage 1 data processing and everything downstream |
| From supplementary data (aggregated only) | Anyone - the public path, no agreement needed | Parts of published result tables and figures that do not require patient-level data. Still all other scripts can be read and analyses can be traced |
Raw sequencing data is available through GHGA (accession: TBD). DKFZ might also provide the remaining per-patient files directly to data-sharing-agreement partners - contact the authors.
From GHGA data + DKFZ-provided data is for data-sharing-agreement partners: DKFZ provides
the panel-scoped per-patient files the DKFZ-internal-only steps would otherwise produce (via
build_entrypoint2_inputs.R), so run_stage1_from_pseudonymized_data.R can run directly from
there. We assume such a partner also has dataMASTER-equivalent access for the CNA/expression
layers, plus a crosswalk table (MASTER PatientID <-> GHGA PID) to correlate that with their
own GHGA-sourced BAMs - see scripts/00_setup/pseudonymization.R for how IDs are
pseudonymized.
# From GHGA data + DKFZ-provided data (data-sharing-agreement partners)
source("run_stage1_from_pseudonymized_data.R")
source("run_analysis_and_figures.R")
# From supplementary data, aggregated only (the public path)
# Many statistics and figures still require per-patient data and are therefore not runnable from this stage
source("run_analysis_and_figures.R")All of these need to be run from the project root (all scripts use
here::here() for paths).
If you're working with the DKFZ-provided per-patient
data: symlink or copy it to the repo root as data/ before running anything -
ln -s internal_checkpoints/entrypoint2_per_patient_data dataIf you only have the public, aggregated-only supplementary data:
ln -s publication_ready_data/entrypoint2_aggregated_supplementary_data dataScripts are organized by which entry point they belong to, not by "preprocessing vs. analysis" - the folder name tells you what you need to run it:
scripts/
00_setup/ # shared helpers: orchestration.R (run_step()
# dispatcher), pseudonymization.R (ID scheme for the
# DKFZ-provided per-patient package), entity_basket_colors.R
# (shared basket_colors palette). Also convert_sample_names.R,
# kept for reference but not currently used.
01_from_raw_data/ # build_entrypoint2_inputs.R only (data-owner-only:
# DKFZ runs this against raw sources to produce the
# per-patient package data-sharing-agreement partners
# receive - kept here so that process is traceable, not
# something you run yourself)
02_from_pseudonymized_data/ # per-patient variant/CNA/expression/methylation
# preparation (scripts 04-14) - what
# run_stage1_from_pseudonymized_data.R runs, against
# the package build_entrypoint2_inputs.R produces -
# plus build_aggregated_supplementary_data.R
# (data-owner-only: produces the ONE publicly
# shared package - aggregate results only, no
# per-patient data)
03_from_supplementary_data/ # from supplementary data: all statistical analysis;
# each script computes its results and saves its own
# figures/tables directly - see "Reproducing this" above
run_stage1_from_pseudonymized_data.R # from GHGA + DKFZ-provided data starts here
run_analysis_and_figures.R # from supplementary data starts here
data/ is never committed to this repo (real patient data is never committed) - it's a
symlink you create yourself, pointing at whichever package matches your access (see
"Reproducing this" above). Key subfolders once it's in place:
metadata/—sample_list.tsvand the 60-gene panel (adme_gene_granges.RData)pgx_pipeline/— PGx Pipeline genotyping output, including{germline,tumor}_genotype_phenotype_harmonized.tsv(per-gene phenotype groups, produced directly by the Pipeline - the underlying per-gene curation logic requires expert allele knowledge and is not part of this repo)known_pgx_allele_variants/— supported star-allele variant sets per tooladditional_variants/— germline/somatic small variants beyond the known setcopy_number_alteration/,expression/,methylation/— per-layer derived dataresults/— pipeline/tool/analysis result files
publication_ready_data/ and internal_checkpoints/ (both gitignored, produced by DKFZ from
real data, not by anything you run yourself) are where the two packages referenced in
"Reproducing this" above come from - the aggregated public export, and the per-patient
package for data-sharing-agreement partners, respectively. Kept in separate directories
specifically so the two are never confused with each other.
Most files under data/ are intermediates a specific script produces - see that script's
header for what it reads/writes. The files below can't be (re)derived by anything in this
repo (hand-curated, licensed/external, or produced by a system outside this repo), grouped by
which reproduction tier has access to each.
Public (included in the aggregated supplementary data package - none of these are per-patient):
| File | Contains | Source |
|---|---|---|
metadata/adme_gene_granges.RData |
The 60-gene PGx panel definition (names, family, genomic coordinates) | Curated by the study team |
metadata/adme_genes_transcripts.tsv |
Transcript IDs for the panel genes | Curated by the study team |
metadata/gencode19_gns_lite.RData |
GENCODE v19 gene annotation subset | Public upstream reference (GENCODE), reformatted |
known_pgx_allele_variants/stargazer_variant_set.txt, pypgx_variant_set.csv |
Each genotyping tool's own supported-variant reference list | External, from each tool's own distribution |
known_pgx_allele_variants/merged_variants_grch37.tsv, ..._rsIDs.tsv |
Aldy/PyPGx/Stargazer variant sets merged into one table | Code-derived (05_prepare_known_variants.R) from the three files above |
additional_variants/apf/methods_thresholds_APF.txt |
In-house APF functional-prediction thresholds | Curated by the study team |
methylation/hg19_methylation_probes_illumina_850k_epic.tsv |
Illumina EPIC array probe manifest | External (Illumina), public |
clinical/PharmGKB_MASTER_2025.xlsx |
Curated drug-gene clinical associations | External database (PharmGKB/ClinPGx), team-selected subset |
clinical/oncology_drugs_full_102025.tsv |
Drug name to drug-class lookup | Curated by the study team |
(Paths for the two clinical/ files above are unconfirmed best-effort guesses - see
14_analyse_drug_gene_associations.R's header.)
GHGA data + DKFZ-provided data (real per-patient data, pseudonymized into the
data-sharing-agreement package by build_entrypoint2_inputs.R):
| File | Contains | Source |
|---|---|---|
metadata/sample_list.tsv |
Per-patient entity basket, sex, age, ploidy, tumor cell content, and compound sample IDs | Curated by the study team |
metadata/entity_basket_annotation.tsv |
Per-patient PID to cancer entity basket mapping | Curated by the study team |
clinical/MASTER_clinical_data_28.07.2026.tsv |
Per-patient drug treatment records (Figure 5C-E) | Curated by the study team (clinical database export) |
pgx_pipeline/run_latest_{germline,tumor}/merged_results/... |
Per-tool star-allele genotype calls | Produced by the private PGx Pipeline |
pgx_pipeline/{germline,tumor}_genotype_phenotype_harmonized.tsv |
Per-gene phenotype-group assignment | Produced by the PGx Pipeline (expert allele-curation logic - see "Reproducing this" above) |
(entity_basket_annotation_reMASTERed.tsv, a same-shaped sibling of the file above, isn't
packaged or used anywhere - unresolved which of the two is reliable.)
Genotyping-tool concordance/accuracy validation (Supplementary Table S1, including the GeT-RM benchmarking) is likewise computed entirely within the private PGx Pipeline, not this repo - there's no corresponding script here to trace.
Never available through this repo, to either audience (DKFZ-internal only):
| File | Contains | Source |
|---|---|---|
dataMASTER/dataMASTER.RData |
Central multi-omics object for the entire MASTER cohort | DKFZ-internal, stricter than generic cluster access |
methylation/raw/*.feather |
Raw per-sample EPIC methylation | DKFZ-internal raw source |
ghga_submission_table.tsv |
MASTER PatientID <-> GHGA PID crosswalk | Handed to a partner directly, never bundled automatically |
Licensed external downloads, not redistributed by this repo - COSMIC Cancer Gene Census
(plus its derivative cancer_gc_genes_with_hg19_coordinates.tsv, pulled from the public
package pending a license check), TCGA expression, gnomAD, AlphaMissense, ANNOVAR humandb -
see Setup above for download instructions.
License: a copyright notice is in place, but no reuse license has been chosen yet - pending institutional review (DKFZ tech transfer, given the separate patent-pending PGx Pipeline repository) and the journal's own requirements. The code is public for examination; a formal license permitting reuse will be added once that review is complete.
Citation: [manuscript citation and DOI to be added on publication].
Original repository history hosted by Roman Tremmel at IKP Stuttgart.