• Preliminary information
  • Transcriptome-wide association methods
    • predict expression
    • assess prediction performance (optional)
    • run association with phenotype
  • Summary PrediXcan
    • download harmonized and imputed GWAS result for coronary artery disease
    • run s-predixcan
    • plot and interpret s-predixcan results
    • run multixcan (optional)
  • Colocalization methods
    • fine-map GWAS results -
    • estimate priors
    • calculate colocalization with fastENLOC
    • analyze results
  • Mendelian randomization methods
    • run SMR (optional)
    • run TWMR (for a locus)

Last updated: 2020-06-04

Checks: 7 0

Knit directory: QGT-Columbia-HKI/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200603) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version d65c555. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/analysis_plan.Rmd) and HTML (docs/analysis_plan.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd d65c555 Hae Kyung Im 2020-06-04 twmr
html d65c555 Hae Kyung Im 2020-06-04 twmr
html 682b6e2 Hae Kyung Im 2020-06-04 Build site.
Rmd d3502e8 Hae Kyung Im 2020-06-04 wflow_publish(“analysis/analysis_plan.Rmd”)
Rmd 4420fc7 Hae Kyung Im 2020-06-04 wflow_rename(“analysis/predixcan_analysis.Rmd”, “analysis/analysis_plan.Rmd”)
html 4420fc7 Hae Kyung Im 2020-06-04 wflow_rename(“analysis/predixcan_analysis.Rmd”, “analysis/analysis_plan.Rmd”)

library(tidyverse)
── Attaching packages ───────────────────────────────────────────────────────── tidyverse 1.3.0 ──
✓ ggplot2 3.3.0     ✓ purrr   0.3.4
✓ tibble  3.0.0     ✓ dplyr   0.8.5
✓ tidyr   1.0.2     ✓ stringr 1.4.0
✓ readr   1.3.1     ✓ forcats 0.5.0
── Conflicts ──────────────────────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()

Preliminary information

Data and copies of repositories can be downloaded from Box here

The latest version of the analysis plan that generated this page is on github here

Transcriptome-wide association methods

print(getwd())
[1] "/Users/haekyungim/Github/QGT-Columbia-HKI"

predict expression


export DATA=$PRE/s-predixcan/data
export MODEL=$PRE/models
export METAXCAN=$PRE/MetaXcan-master/software
export RESULTS=$PRE/results

printf "Predict expression\n\n"
python3 $METAXCAN/Predict.py \
--model_db_path $DATA/models/gtex_v8_en/en_Whole_Blood.db \
--vcf_genotypes $DATA/1000G_hg38/ALL.chr22.shapeit2_integrated_snvindels_v2a_27022019.GRCh38.phased.vcf.gz \
--vcf_mode genotyped \
--variant_mapping $DATA/gtex_v8_eur_filtered_maf0.01_monoallelic_variants.txt.gz id rsid \
--on_the_fly_mapping METADATA "chr{}_{}_{}_{}_b38" \
--prediction_output $RESULTS/vcf_1000G_hg38_en/Whole_Blood__predict.txt \
--prediction_summary_output $RESULTS/vcf_1000G_hg38_en/Whole_Blood__summary.txt \
--verbosity 9 \
--throw

assess prediction performance (optional)

## merge with GEUVADIS expression data

## calculate spearman correlation

## select a few genes and plot predicted vs observed expression

run association with phenotype

printf "association\n\n"
python3 $METAXCAN/PrediXcanAssociation.py \
--expression_file $RESULTS/vcf_1000G_hg38_en/Whole_Blood__predict.txt \
--input_phenos_file $DATA/1000G_hg38/random_pheno_1000G_hg38.txt \
--input_phenos_column pheno \
--output $RESULTS/vcf_1000G_hg38_en/Whole_Blood__association.txt \
--verbosity 9 \
--throw

Summary PrediXcan

download harmonized and imputed GWAS result for coronary artery disease


export PRE=/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI
export DATA=$PRE/s-predixcan/data
export MODEL=$PRE/models
export METAXCAN=$PRE/MetaXcan-master/software
export OUTPUT=$PRE/results

echo $PRE
echo $DATA
echo $MODEL
echo $METAXCAN
echo $OUTPUT
/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI
/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/s-predixcan/data
/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/models
/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/MetaXcan-master/software
/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/results

run s-predixcan


export PRE=/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI
export DATA=$PRE/s-predixcan/data
export MODEL=$PRE/models
export METAXCAN=$PRE/MetaXcan-master/software
export OUTPUT=$PRE/results

python $METAXCAN/SPrediXcan.py \
--gwas_file  $DATA/imputed_CARDIoGRAM_C4D_CAD_ADDITIVE.txt.gz \
--snp_column panel_variant_id --effect_allele_column effect_allele --non_effect_allele_column non_effect_allele --zscore_column zscore \
--model_db_path $MODEL/gtex_v8_mashr/mashr_Whole_Blood.db \
--covariance $MODEL/gtex_v8_mashr/mashr_Whole_Blood.txt.gz \
--keep_non_rsid --additional_output --model_db_snp_key varID \
--throw \
--output_file $OUTPUT/spredixcan/eqtl/CARDIoGRAM_C4D_CAD_ADDITIVE__PM__Whole_Blood.csv

plot and interpret s-predixcan results

run multixcan (optional)


python $METAXCAN/SMulTiXcan.py \
--models_folder $DATA/models/eqtl/mashr \
--models_name_pattern "mashr_(.*).db" \
--snp_covariance $DATA/models/gtex_v8_expression_mashr_snp_covariance.txt.gz \
--metaxcan_folder $OUTPUT/spredixcan/eqtl/ \
--metaxcan_filter "CARDIoGRAM_C4D_CAD_ADDITIVE__PM__(.*).csv" \
--metaxcan_file_name_parse_pattern "(.*)__PM__(.*).csv" \
--gwas_file $OUTPUT/processed_summary_imputation/imputed_CARDIoGRAM_C4D_CAD_ADDITIVE.txt.gz \
--snp_column panel_variant_id --effect_allele_column effect_allele --non_effect_allele_column non_effect_allele --zscore_column zscore --keep_non_rsid --model_db_snp_key varID \
--cutoff_condition_number 30 \
--verbosity 7 \
--throw \
--output $OUTPUT/smultixcan/eqtl/CARDIoGRAM_C4D_CAD_ADDITIVE_smultixcan.txt

Colocalization methods

fine-map GWAS results -

We will run torus due to time limitation but ideally we would like to run a method that allows multiple causal variants per locus.


#torus -d Height.torus.zval.gz --load_zval -dump_pip Height.gwas.pip
#gzip Height.gwas.pip

torus -d /Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/fastenloc/data/Height.torus.zval.gz --load_zval -dump_pip /Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI/fastenloc/data/Height.gwas.pip
gzip Height.gwas.pip

estimate priors

is this done internally by fastENLOC?

calculate colocalization with fastENLOC

## tutorial https://github.com/xqwen/fastenloc/tree/master/tutorial

export EQTLGZ=eqtl_annotation_gzipped
export GWASGZ=gwas_data_gzipped
export TISSUE=Whole_Blood
fastenloc -eqtl EQTLGZ -gwas GWASGZ -t tissue_name #[-total_variants total_snp] [-thread n] [-prefix prefix_name] [-s shrinkage]

analyze results

## optional - compare with s-predixcan results

Mendelian randomization methods

run SMR (optional)

run TWMR (for a locus)


cd $TWMR
export PRE=/Users/haekyungim/Box/LargeFiles/QGT-Columbia-HKI
export TWMR=$PRE/repos/TWMR-master
export OUTPUT=$PRE/results
GENE=ENSG00000002919

R < $TWMR/MR.R --no-save $GENE

cd $PRE

-[ ] todo: write an R function


sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.2

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] forcats_0.5.0   stringr_1.4.0   dplyr_0.8.5     purrr_0.3.4    
[5] readr_1.3.1     tidyr_1.0.2     tibble_3.0.0    ggplot2_3.3.0  
[9] tidyverse_1.3.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.0.0 xfun_0.13        haven_2.2.0      lattice_0.20-41 
 [5] colorspace_1.4-1 vctrs_0.2.4      generics_0.0.2   htmltools_0.4.0 
 [9] yaml_2.2.1       rlang_0.4.5      later_1.0.0      pillar_1.4.3    
[13] withr_2.1.2      glue_1.4.1       DBI_1.1.0        dbplyr_1.4.2    
[17] readxl_1.3.1     modelr_0.1.6     lifecycle_0.2.0  cellranger_1.1.0
[21] munsell_0.5.0    gtable_0.3.0     workflowr_1.6.2  rvest_0.3.5     
[25] evaluate_0.14    knitr_1.28       httpuv_1.5.2     fansi_0.4.1     
[29] broom_0.5.5      Rcpp_1.0.4.6     promises_1.1.0   backports_1.1.6 
[33] scales_1.1.0     jsonlite_1.6.1   fs_1.4.1         hms_0.5.3       
[37] digest_0.6.25    stringi_1.4.6    rprojroot_1.3-2  grid_3.6.3      
[41] cli_2.0.2        tools_3.6.3      magrittr_1.5     crayon_1.3.4    
[45] whisker_0.4      pkgconfig_2.0.3  ellipsis_0.3.0   xml2_1.3.1      
[49] reprex_0.3.0     lubridate_1.7.8  rstudioapi_0.11  assertthat_0.2.1
[53] rmarkdown_2.1    httr_1.4.1       R6_2.4.1         nlme_3.1-147    
[57] git2r_0.26.1     compiler_3.6.3