Code to generate the data and website for Rat TWAS Hub.
This repository runs large-scale, multi-modal TWAS analyses in rat and produces static Markdown reports plus a Jekyll site. It is adapted from the (human) TWAS HUB and extends gene expression-based TWAS to multi-modal RNA phenotypes (xTWAS) using Pantry to generate phenotypes for the transcriptome models.
- Python 3 with
snakemakeandpandas. - R (4.x recommended) with packages:
- required:
tidyverse,yaml,biomaRt,optparse,plink2R,RColorBrewer,coloc
- required:
- GNU core tools (
awk,sed,join,tar,gzip) andparallel. - Ruby +
bundlerfor Jekyll site builds (seejekyll/Gemfile). rsync+sshfor deployment (optional).
Notes:
- The cross-species step uses Ensembl via
biomaRtand requires network access. - TWAS runs require binary PLINK reference panels (see inputs below).
The pipeline expects the following inputs under data/:
panels.tsv: Transcriptome panel metadata (columns includePANEL,TISSUE,MODALITY,N).traits.tsv: Trait metadata (columns includeOUTPUT,ID,N,PROJECT,TAGS,NAME,DESCRIPTION).projects.tsv: Project metadata used for the site.sequence_report.tsv: Chromosome sizes for porcupine plots.WEIGHTS/<tissue>/<modality>.posand<modality>.profile: FUSION profiler outputs used to builddata/all_models.tsv.LDREF/Brain_v4.chr{chrom}.{bed,bim,fam}: PLINK reference LD panels used by FUSION.gwas_original/sumstats/{project}/regressedlr_{trait}_chrgwas{chrom}.mlma.gz: GWAS summary statistics (GCTA output).gwas_original/traits.tsv: Project + trait metadata used byscripts/prepare/prepare_trait_table.R(columns:project_id,trait_id,tags,name,description).cross_species/genes.models.nfoandcross_species/genes.nfo: Human reference lists for the cross-species table.
Generated outputs live in:
data/all_models.tsv,data/twas_out/,data/traits.summary.tsv,data/genes_n_models.tsv,data/genes_n_assoc.tsvjekyll/(traits, genes, and_dataassets consumed by the site)
- Prepare trait metadata (optional, if starting from raw GWAS):
scripts/prepare/prepare_traits.shThis reads data/gwas_original/traits.tsv and GCTA logs to produce data/traits.tsv.
- Run TWAS + post-processing + site data build:
snakemake -j 8If running on HPC, be sure to run in a job, or have snakemake run steps as jobs using, e.g., snakemake-executor-plugin-slurm.
- Build the Jekyll site:
cd jekyll
bundle install
bundle exec jekyll build- Deploy (optional, requires SSH access to the target host):
scripts/site/deploy.shSnakefile: Main workflow (TWAS, post-processing, and site data generation).scripts/twas/: FUSION TWAS and post-processing scripts.scripts/site/: Jekyll data builders and plot generation.scripts/prepare/: Trait table helpers for GWAS inputs.jekyll/: Site templates and assets.