This mini-protocol selects and runs cis-, trans-, or interaction-QTL association testing with the TensorQTL module.
Miniprotocol Timing¶
Timing: TBD
Overview¶
QTL association testing identifies genetic variants associated with molecular traits such as gene expression. This mini-protocol calls TensorQTL.ipynb for three independent analyses: a cis scan of variants near each molecular trait, a trans scan of variants outside the local region, and an interaction scan testing whether a covariate modifies the genotype effect.
Run the genotype-, phenotype-, and covariate-preprocessing mini-protocols first. Their outputs provide chromosome-indexed PLINK genotypes, chromosome-indexed molecular phenotypes, and a sample-aligned covariate matrix. The association results can then be passed to association postprocessing, fine-mapping, or multi-omics integration.
Choose one route below; the three commands are alternatives rather than one mandatory chain.
Steps¶
Choose one route; cis-, trans-, and interaction-QTL scans answer different questions and are not a mandatory chain.
| Analysis goal | Command to run | Inputs |
|---|---|---|
| Test local genetic effects within each phenotype’s cis window | 1 | output/genotype_by_chrom/protocol_example.genotype.merged.plink_qc.genotype_by_chrom_files.txt; output/phenotype/phenotype_by_chrom_for_cis/bulk_rnaseq.phenotype_by_chrom_files.txt; output/covariate/protocol_example.rnaseq.bed.protocol_example.covariates.protocol_example.genotype.merged.plink_qc.plink_qc.prune.pca.Marchenko_PC.gz |
| Test distal effects across chromosomes | 2 | The same genotype, phenotype, and covariate files, plus data/combined_AD_genes.csv as the example phenotype-region list |
| Test whether a covariate modifies a cis-QTL effect | 3 | The same genotype, phenotype, and covariate files, plus the interaction variable msex in the covariate data |
Run only the command matching the scientific question.
1. cis-QTL scan¶
What it does: Tests each molecular trait against variants within its cis window, using --MAC 5 for the small chromosome 22 example.
sos run pipeline/TensorQTL.ipynb cis \
--genotype-file output/genotype_by_chrom/protocol_example.genotype.merged.plink_qc.genotype_by_chrom_files.txt \
--phenotype-file output/phenotype/phenotype_by_chrom_for_cis/bulk_rnaseq.phenotype_by_chrom_files.txt \
--covariate-file output/covariate/protocol_example.rnaseq.bed.protocol_example.covariates.protocol_example.genotype.merged.plink_qc.plink_qc.prune.pca.Marchenko_PC.gz \
--cwd output/tensorqtl_cis --name protocol_example --MAC 5 --numThreads 22. trans-QTL scan¶
What it does: Tests the selected traits against variants on chromosome 22, restricting traits to the identifiers listed in data/combined_AD_genes.csv.
sos run pipeline/TensorQTL.ipynb trans \
--genotype-file output/genotype_by_chrom/protocol_example.genotype.merged.plink_qc.genotype_by_chrom_files.txt \
--phenotype-file output/phenotype/phenotype_by_chrom_for_cis/bulk_rnaseq.phenotype_by_chrom_files.txt \
--covariate-file output/covariate/protocol_example.rnaseq.bed.protocol_example.covariates.protocol_example.genotype.merged.plink_qc.plink_qc.prune.pca.Marchenko_PC.gz \
--cwd output/tensorqtl_trans --name protocol_example --MAC 5 --numThreads 2 \
--trans-geno-chromosome 22 --region-list data/combined_AD_genes.csv --region-list-phenotype-column 43. interaction-QTL scan¶
What it does: Runs the cis model with a genotype-by-msex interaction term and reports evidence that the genotype effect changes with this covariate.
sos run pipeline/TensorQTL.ipynb cis \
--genotype-file output/genotype_by_chrom/protocol_example.genotype.merged.plink_qc.genotype_by_chrom_files.txt \
--phenotype-file output/phenotype/phenotype_by_chrom_for_cis/bulk_rnaseq.phenotype_by_chrom_files.txt \
--covariate-file output/covariate/protocol_example.rnaseq.bed.protocol_example.covariates.protocol_example.genotype.merged.plink_qc.plink_qc.prune.pca.Marchenko_PC.gz \
--cwd output/tensorqtl_int --name protocol_example --MAC 5 --numThreads 2 \
--interaction msex --maf-threshold 0.05 --no-permutationOutput¶
| Route | Relative path | Contents |
|---|---|---|
| cis-QTL | output/tensorqtl_cis/protocol_example.<phenotype_chr>_<genotype_chr>.cis_qtl.pairs.tsv.gz | Nominal statistics for tested cis variant-trait pairs |
| cis-QTL | output/tensorqtl_cis/protocol_example.<phenotype_chr>_<genotype_chr>.cis_qtl_regional_significance.tsv.gz | Region-level permutation and multiple-testing results |
| cis-QTL | output/tensorqtl_cis/protocol_example.<phenotype_chr>.cis_qtl_pairs.<chromosome>.parquet | Native TensorQTL nominal results retained for reuse |
| trans-QTL | output/tensorqtl_trans/protocol_example.<phenotype_chr>_geno_chr22.trans_qtl.pairs.tsv.gz | Trans-association statistics for chromosome 22 |
| interaction-QTL | output/tensorqtl_int/protocol_example.<phenotype_chr>_<genotype_chr>_msex.cis_qtl.pairs.tsv.gz | Nominal genotype, interaction, and genotype-by-interaction effects |
Tabix index files (.tbi) accompany the bgzipped result tables. Exact chromosome tokens follow the input file lists.
Anticipated Results¶
The selected route produces association statistics for the chromosome 22 example. Cis analysis returns nominal variant-trait results plus region-level significance summaries; trans analysis returns the restricted cross-region tests; interaction analysis adds main and genotype-by-covariate effect estimates.
Proceed to association postprocessing when calibrated regional summaries are needed, or use the nominal and region-level tables as input to the appropriate fine-mapping or integration workflow.
Command Interface¶
Inspect all TensorQTL workflows, options, and defaults:
sos run pipeline/TensorQTL.ipynb -h