Last updated: 2023-08-10

Checks: 6 1

Knit directory: m6A_in_disease_genetics/

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


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

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(20230331) 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 c230e76. 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:    .ipynb_checkpoints/
    Ignored:    analysis/m6A_switch_to_disease_h2g.nb.html
    Ignored:    data/plots/

Untracked files:
    Untracked:  analysis/.ipynb_checkpoints/
    Untracked:  analysis/IBD_E_S_m6A.Rmd
    Untracked:  analysis/IBD_E_S_m6A_output.Rmd
    Untracked:  analysis/LDL_E_S_m6A.Rmd
    Untracked:  analysis/LDL_m6A_output.Rmd
    Untracked:  analysis/RA_m6A_output.Rmd
    Untracked:  analysis/WhiteBlood_WholeBlood_E_M.Rmd
    Untracked:  analysis/learn_ctwas.Rmd
    Untracked:  analysis/lymph_m6A_output.Rmd
    Untracked:  analysis/pre_weights_m6AQTL.txt
    Untracked:  analysis/rbc_E_S_m6A_output.Rmd
    Untracked:  analysis/rbc_m6A_output.Rmd
    Untracked:  analysis/wbc_E_S_m6A_output.Rmd
    Untracked:  analysis/wbc_m6A_output.Rmd
    Untracked:  code/.ipynb_checkpoints/
    Untracked:  code/all_m6a_sites_with_paired_cisNATs_summary.csv
    Untracked:  code/check_double_strand.ipynb
    Untracked:  code/check_double_strand_v2.ipynb
    Untracked:  code/ctwas/
    Untracked:  code/figure/
    Untracked:  code/learn_gviz.Rmd
    Untracked:  code/learn_gviz.html
    Untracked:  code/learn_gviz.nb.html
    Untracked:  code/m6AQTL_finemapping.Rmd
    Untracked:  code/summary_TWAS_coloc_m6A_2023.Rmd
    Untracked:  code/test_gviz.ipynb
    Untracked:  code/twas_genes_PP4_0.3_immune_traits_trackplots.pdf
    Untracked:  data/.ipynb_checkpoints/
    Untracked:  data/ADCY7_gwas_input.tsv
    Untracked:  data/ADCY7_qtl_input.tsv
    Untracked:  data/Allergy_full_coloc.txt
    Untracked:  data/Asthma_full_coloc.txt
    Untracked:  data/CAD_full_coloc.txt
    Untracked:  data/Eosinophil_count_full_coloc.txt
    Untracked:  data/GSE125377_jointPeakReadCount.txt
    Untracked:  data/IBD_full_coloc.txt
    Untracked:  data/JointPeaks.bed
    Untracked:  data/Li2022_dsRNAs.xlsx
    Untracked:  data/Lupus_full_coloc.txt
    Untracked:  data/RA_full_coloc.txt
    Untracked:  data/TABLE1_hg19.txt
    Untracked:  data/TABLE1_hg19.txt.zip
    Untracked:  data/__MACOSX/
    Untracked:  data/coloc_blood_traits.csv
    Untracked:  data/crohns_disease_full_coloc.txt
    Untracked:  data/edit_sites_and_GE_neg_correlated.txt
    Untracked:  data/edit_sites_and_GE_pos_correlated.txt
    Untracked:  data/features
    Untracked:  data/human_EERs.csv
    Untracked:  data/human_EERs.txt
    Untracked:  data/lymph_full_coloc.txt
    Untracked:  data/m6A_TWAS_results.csv
    Untracked:  data/m6a_TWAS_genes.txt
    Untracked:  data/m6a_joint_calling_peaks.csv
    Untracked:  data/nat_sense_pairs.csv
    Untracked:  data/plt_full_coloc.txt
    Untracked:  data/rbc_full_coloc.txt
    Untracked:  data/rdw_full_coloc.txt
    Untracked:  data/reported_AS_targets_S1.txt
    Untracked:  data/reported_AS_wanowska.txt
    Untracked:  data/sig_coloc_results/
    Untracked:  data/test_locuscomparer.pdf
    Untracked:  data/ulcerative_colitis_full_coloc.txt
    Untracked:  data/wbc_full_coloc.txt
    Untracked:  output/.ipynb_checkpoints/
    Untracked:  output/all_m6a_sites_with_cisNATs.csv
    Untracked:  output/all_m6a_sites_with_paired_cisNATs_summary.csv
    Untracked:  output/all_m6a_sites_with_paired_cisNATs_summary_PP40.3.csv
    Untracked:  output/all_m6a_sites_with_paired_cisNATs_summary_PP40.5.csv
    Untracked:  output/all_m6a_sites_with_paired_cis_NATs.csv
    Untracked:  output/fine_mapped_m6AQTLs_TWAS_genes_highPP4.rds
    Untracked:  output/gene_summary.csv
    Untracked:  output/immune_related_m6A_targets.csv
    Untracked:  output/m6aQTL_dsRNAs_PPP2R3C_PRORP.pdf
    Untracked:  output/m6a_peaks_nearby_dsRNAs.csv
    Untracked:  output/m6a_sites_near_all_dsRNAs_twas.csv
    Untracked:  output/m6a_sites_near_dsRNAs_coloc.csv
    Untracked:  output/m6a_sites_near_dsRNAs_twas.csv
    Untracked:  output/m6a_sites_near_dsRNAs_twas_summary.csv
    Untracked:  output/m6a_sites_overlapping_NAT_twas.csv
    Untracked:  output/m6a_sites_overlapping_dsRNAs_coloc.csv
    Untracked:  output/m6a_sites_overlapping_dsRNAs_twas.csv
    Untracked:  output/m6a_sites_overlapping_dsRegions.csv
    Untracked:  output/m6a_sites_overlapping_dsRegions_coloc.csv
    Untracked:  output/negatively_correlated_genes.txt
    Untracked:  output/postively_correlated_genes.txt
    Untracked:  output/rs1806261_RABEP1-NUP88_focused_locusview.pdf
    Untracked:  output/rs1806261_RABEP1-NUP88_locusview.pdf
    Untracked:  output/rs3177647_MAPKAPK5-AS1-MAPKAPK5_locusview.pdf
    Untracked:  output/rs3204541_DDX55-EIF2B1_locusview.pdf
    Untracked:  output/rs7184802_ADCY7-BRD7_locusview.pdf
    Untracked:  output/rs7184802_ADCY7_locuscompare.pdf
    Untracked:  output/twas_genes_PP4_0.3_immune_traits_trackplots.pdf
    Untracked:  output/twas_genes_PP4_0.5_blood_traits_trackplots.pdf
    Untracked:  output/twas_m6a_sites_with_all_cisNATs.RDS
    Untracked:  output/twas_m6a_sites_with_cisNATs_range.RDS
    Untracked:  output/twas_m6a_sites_with_the_nearest_cisNAT.RDS
    Untracked:  twas_genes_PP4_0.3_immune_traits_trackplots.pdf

Unstaged changes:
    Modified:   analysis/index.Rmd
    Modified:   analysis/m6A_switch_to_disease_h2g.Rmd

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.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


Method overall

Causal TWAS is a method that adjusts for confounders that drive variants-trait associations to identify causal genes. The confounders could be genetic variants in LD with the true causal one regulating genes that do not affect traits, or variants have direct effects on traits not through altering gene expression. The general way to model this problem is as follows: \[ Y = \sum_k\sum_{j\in M_k}\beta_jX_j + \epsilon, \text{ } \epsilon \sim N(0, \sigma^2) \] where variants are grouped into K categories and the effect size for each category can be modeled by a spike and slab normal distribution. The estimation of parameters were done using Expectation-maximum algorithm, and finally the posterior causal probability for individual variant can be calculated.

In EM algorithm, the updated rules for \(\pi_k^{(t+1)}\) is average PIPs for each K group and \(\sigma^{2,(t+1)}_{t}\) is sum of PIPs weighted by second moment of posterior effect size.

The calculation of PIPs and second moment is by analyzing each block one at a time under the single effect approximation using SuSiE.

Assuming each single block explains a minimal variance of y, so \(\sigma = 1\).

Setting and functions

load TWAS weights

Todo: re-run TWAS for a subset of GEUVADIS LCL samples that match with 60 LCLs in our m6A-QTL study

generate prediction DB weights

Add rsIDs, varIDs

test cTWAS on example data

Procedure QCs

The extent of selected QTLs using YRI samples missing in UKBB variants

Due to LD mismatch between African and European ancestry, we would like to estimate the fraction of top QTLs identified from individuals of African ancestry that are missing from UKBB variants. The table below shows less than 4% of selected SNPs with YRI samples are not found in those with UKBB samples across three models for expression, splicing or m6A QTL data.

[1] "eQTL" "962"  "920" 
[1] "eQTL" "5835" "5671"
[1] "eQTL"  "16601" "16153"
[1] "sQTL" "1310" "1271"
[1] "sQTL" "6380" "6207"
[1] "sQTL"  "17023" "16597"
[1] "m6aQTL" "478"    "467"   
[1] "m6aQTL" "2514"   "2440"  
[1] "m6aQTL" "6357"   "6176"  
  feature top1 lasso enet
1    eQTL 0.04  0.03 0.03
2    sQTL 0.03  0.03 0.03
3  m6aQTL 0.02  0.03 0.03

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.3.13-el7-x86_64/lib/libopenblas_haswellp-r0.3.13.so

locale:
 [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C           
 [4] LC_COLLATE=C         LC_MONETARY=C        LC_MESSAGES=C       
 [7] LC_PAPER=C           LC_NAME=C            LC_ADDRESS=C        
[10] LC_TELEPHONE=C       LC_MEASUREMENT=C     LC_IDENTIFICATION=C 

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

other attached packages:
 [1] forcats_0.5.1     stringr_1.5.0     purrr_1.0.1       readr_2.1.4      
 [5] tidyr_1.3.0       tibble_3.2.1      ggplot2_3.4.2     tidyverse_1.3.1  
 [9] RSQLite_2.3.1     data.table_1.14.8 dplyr_1.1.2       ctwas_0.1.38     

loaded via a namespace (and not attached):
 [1] httr_1.4.6        sass_0.4.1        bit64_4.0.5       jsonlite_1.8.7   
 [5] foreach_1.5.2     pgenlibr_0.3.6    logging_0.10-108  modelr_0.1.8     
 [9] bslib_0.3.1       blob_1.2.4        cellranger_1.1.0  yaml_2.3.5       
[13] pillar_1.9.0      backports_1.4.1   lattice_0.20-45   glue_1.6.2       
[17] digest_0.6.33     promises_1.2.0.1  rvest_1.0.2       colorspace_2.1-0 
[21] htmltools_0.5.2   httpuv_1.6.5      Matrix_1.6-0      pkgconfig_2.0.3  
[25] broom_0.8.0       haven_2.5.0       scales_1.2.1      later_1.3.0      
[29] tzdb_0.4.0        git2r_0.30.1      generics_0.1.3    DT_0.22          
[33] cachem_1.0.8      withr_2.5.0       cli_3.6.1         magrittr_2.0.3   
[37] crayon_1.5.2      readxl_1.4.3      memoise_2.0.1     evaluate_0.15    
[41] fs_1.6.3          fansi_1.0.4       xml2_1.3.3        tools_4.2.0      
[45] hms_1.1.3         lifecycle_1.0.3   munsell_0.5.0     reprex_2.0.1     
[49] compiler_4.2.0    jquerylib_0.1.4   rlang_1.1.1       grid_4.2.0       
[53] iterators_1.0.14  rstudioapi_0.15.0 htmlwidgets_1.5.4 crosstalk_1.2.0  
[57] rmarkdown_2.14    gtable_0.3.3      codetools_0.2-18  DBI_1.1.3        
[61] R6_2.5.1          lubridate_1.8.0   knitr_1.39        fastmap_1.1.1    
[65] bit_4.0.5         utf8_1.2.3        workflowr_1.7.0   rprojroot_2.0.3  
[69] stringi_1.7.12    Rcpp_1.0.11       vctrs_0.6.3       dbplyr_2.3.3     
[73] tidyselect_1.2.0  xfun_0.30