Last updated: 2020-07-08

Checks: 7 0

Knit directory: analysis_pipelines/

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(20200524) 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 518b647. 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:    .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/sldsc_example_GTEx_QTLs.Rmd) and HTML (docs/sldsc_example_GTEx_QTLs.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 518b647 kevinlkx 2020-07-08 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html 6e6d41a kevinlkx 2020-07-08 Build site.
Rmd 05e3495 kevinlkx 2020-07-08 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html 8bc5bff kevinlkx 2020-07-07 Build site.
Rmd cbf162f kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html 79339c3 kevinlkx 2020-07-07 Build site.
Rmd f65f2f9 kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html 5ed6738 kevinlkx 2020-07-07 Build site.
Rmd 3499b1e kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html c623ef5 kevinlkx 2020-07-07 Build site.
Rmd dfa71eb kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html 511d991 kevinlkx 2020-07-07 Build site.
Rmd 378c608 kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html ccff01a kevinlkx 2020-07-07 Build site.
Rmd 648285a kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)
html b70df47 kevinlkx 2020-07-07 Build site.
Rmd 5b9eac1 kevinlkx 2020-07-07 wflow_publish(“analysis/sldsc_example_GTEx_QTLs.Rmd”)

Run S-LDSC on data from Hormozdiari, F. et al. Nature Genetics 2018 paper

  • Use the GTEx_FE_META_TISSUE_GE_MaxCPP annotation (MaxCPP annotation computed from fixed-effect meta-analysis of eQTLs from 44 GTEx tissues)
  • Compute the GTEx_FE_META_TISSUE_GE_MaxCPP annotation conditional on baselineLD_v1.1

TRAITS=("PASS_BMI1" "PASS_Rheumatoid_Arthritis" "PASS_Schizophrenia" "UKB_460K.blood_WHITE_COUNT" "UKB_460K.blood_PLATELET_COUNT")

for trait in "${TRAITS[@]}"
do
  sbatch ~/projects/analysis_pipelines/code/sldsc_annot_GTEx_QTL_separate_example.sbatch ${trait} GTEx_FE_META_TISSUE_GE_MaxCPP
done

Extract S-LDSC enrichment for the GTEx_FE_META_TISSUE_GE_MaxCPP annotation

  • Note: the enrichment values of those traits should match those in the supplementary table 10 of Hormozdiari, F. et al. Nature Genetics 2018 paper.
## barplot for S-LDSC enrichment 
barplot_enrichment <- function(result_sLDSC, ylim = NULL, title = "", horizontal = FALSE){
  
  result_sLDSC$Enrichment_L <- result_sLDSC$Enrichment - 1.96*result_sLDSC$Enrichment_std_error
  result_sLDSC$Enrichment_H <- result_sLDSC$Enrichment + 1.96*result_sLDSC$Enrichment_std_error
  
  p <- ggplot(result_sLDSC, aes(x = Category, y = Enrichment))+
    geom_bar(position=position_dodge(), stat="identity", width = 0.5) +
    geom_errorbar(aes(ymin=Enrichment_L,
                      ymax=Enrichment_H),
                  width=.1,                    # Width of the error bars
                  position=position_dodge(.9)) + 
    ylab("Enrichment")+ xlab("") +
    ggtitle(title) +
    geom_hline(yintercept = 1,linetype="dotted", colour = "red")+
    theme_classic() +
    theme(axis.text.x = element_text(angle=30, hjust=1, size = 14))
  if(!is.null(ylim)){
    p <- p + coord_cartesian(ylim = ylim)
  }
  
  if(horizontal){
    p <- p + coord_flip()
  }
  print(p)
}

change_trait_names <- function(trait_namelist){
  trait_namelist <- gsub("PASS_","", trait_namelist)
  trait_namelist <- gsub("BMI1","BMI", trait_namelist)
  trait_namelist <- gsub("Rheumatoid_Arthritis","Rheumatoid Arthritis", trait_namelist)
  trait_namelist <- gsub("UKB_460K.blood_WHITE_COUNT","White Blood Cell Count", trait_namelist)
  trait_namelist <- gsub("UKB_460K.blood_PLATELET_COUNT","Platelet Count", trait_namelist)
}
library(foreach)
library(doParallel)
Loading required package: iterators
Loading required package: parallel
registerDoParallel(cores = 6)

dir_results <- paste0("/project2/xinhe/kevinluo/ldsc/results/sLDSC_Hormozdiari_NG2018/LDSC_QTL/results_sLDSC/")

trait_name_list <- c("PASS_BMI1", "PASS_Rheumatoid_Arthritis", "PASS_Schizophrenia", "UKB_460K.blood_WHITE_COUNT", "UKB_460K.blood_PLATELET_COUNT")

prefix_annot <- "GTEx_FE_META_TISSUE_GE_MaxCPP"

result_sLDSC <- foreach(trait = trait_name_list, .combine = rbind)%dopar%{
  sldsc_results <- read.table(paste0(dir_results,"/", trait, "/baselineLDv1.1/", trait, "_", prefix_annot, "_baselineLDv1.1.results"), header = T, stringsAsFactors = F)
  est <- sldsc_results[sldsc_results$Category == "L2_1",]
  est$Category <- trait
  est
}

result_sLDSC$Category <- change_trait_names(result_sLDSC$Category)
DT::datatable(format(result_sLDSC, digits = 3), options = list(scrollX = TRUE, keys = TRUE, pageLength = 20),rownames = F)

Plot S-LDSC enrichment for the GTEx_FE_META_TISSUE_GE_MaxCPP annotation

  • Error bars represent 95% CI
library(ggplot2)

barplot_enrichment(result_sLDSC)

Version Author Date
511d991 kevinlkx 2020-07-07
b70df47 kevinlkx 2020-07-07

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

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

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

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

other attached packages:
[1] ggplot2_3.3.0     doParallel_1.0.14 iterators_1.0.12  foreach_1.5.0    
[5] workflowr_1.6.2  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6      pillar_1.4.4      compiler_3.5.1    later_1.0.0      
 [5] git2r_0.27.1      tools_3.5.1       digest_0.6.25     tibble_3.0.1     
 [9] lifecycle_0.2.0   jsonlite_1.6      evaluate_0.14     gtable_0.3.0     
[13] pkgconfig_2.0.3   rlang_0.4.6       shiny_1.4.0.2     crosstalk_1.0.0  
[17] yaml_2.2.0        xfun_0.14         fastmap_1.0.1     withr_2.1.2      
[21] dplyr_0.8.5       stringr_1.4.0     knitr_1.28        vctrs_0.3.0      
[25] fs_1.3.1          htmlwidgets_1.5.1 tidyselect_0.2.5  rprojroot_1.3-2  
[29] DT_0.13           grid_3.5.1        glue_1.4.1        R6_2.4.1         
[33] rmarkdown_2.1     farver_2.0.3      purrr_0.3.4       magrittr_1.5     
[37] whisker_0.4       ellipsis_0.3.1    backports_1.1.7   scales_1.1.1     
[41] codetools_0.2-15  promises_1.1.0    htmltools_0.4.0   assertthat_0.2.1 
[45] colorspace_1.4-1  mime_0.9          xtable_1.8-4      httpuv_1.5.3.1   
[49] labeling_0.3      stringi_1.4.6     munsell_0.5.0     crayon_1.3.4