Last updated: 2021-11-29
Checks: 7 0
Knit directory: cause/
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(20181014)
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 7bdec64. 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/
Ignored: ll_v7_notes.Rmd
Ignored: ll_v7_notes.html
Ignored: pipeline_code/ld/
Ignored: pipeline_code/plink_reference/
Ignored: pipeline_code/raw_data/
Ignored: sim_results/
Ignored: src/RcppExports.o
Ignored: src/cause.so
Ignored: src/log_likelihood_functions.o
Ignored: tests/
Untracked files:
Untracked: .Rhistory (tumble-track's conflicted copy 2021-07-15)
Untracked: cause.Rcheck/
Untracked: example_data/chr22_AF0.05_0.1.RDS
Untracked: example_data/chr22_AF0.05_snpdata.RDS
Untracked: example_data/ieu-b-38.vcf.gz
Untracked: example_data/ieu-b-38.vcf.gz.tbi
Untracked: example_data/ukb-b-9405.vcf.gz
Untracked: example_data/ukb-b-9405.vcf.gz.tbi
Unstaged changes:
Deleted: analysis/figure/simulations.Rmd/plot_fp-1.png
Deleted: analysis/figure/simulations.Rmd/roc-1.png
Deleted: analysis/figure/simulations.Rmd/unnamed-chunk-3-1.png
Deleted: analysis/figure/simulations.Rmd/unnamed-chunk-5-1.png
Deleted: analysis/figure/simulations.Rmd/unnamed-chunk-6-1.png
Modified: src/RcppExports.cpp
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/mrcieu.Rmd
) and HTML (docs/mrcieu.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 | 7bdec64 | Jean Morrison | 2021-11-29 | wflow_publish(files = c(“analysis/mrcieu.Rmd”, “analysis/ldl_cad.Rmd”)) |
The IEU Open GWAS Project is a fantastic resource of GWAS summary statistics. This database contains most of the summary statistics available in the GWAS Catalog, several sets of UK Biobank derived summary statistics and results from a few other sources, all of which can be queried without downloading or downloaded in a uniform VCF format. In this document we will show how to make use of this resource along with the associated R packages gwasvcf
and ieugwasr
.
We will need the following pacakages:
VariantAnnotation
gwasvcf
ieugwasr
We also use cause
and dplyr
. This analysis includes optionally using PLINK to prune for LD rather than using the function in the CAUSE pacakage. To do this you will also need to have PLINK installed and know the path the the PLINK binary.
library(gwasvcf)
library(ieugwasr)
library(VariantAnnotation)
library(dplyr)
library(cause)
For this analysis, we will use the same LDL cholesterol/coronary artery disease example used in the software introduction but we will process it using the MRC IEU tools. First download the data
wget https://gwas.mrcieu.ac.uk/files/ebi-a-GCST002222/ebi-a-GCST002222.vcf.gz
wget https://gwas.mrcieu.ac.uk/files/ebi-a-GCST005195/ebi-a-GCST005194.vcf.gz
We read the data into a data frame and then add a column for \(p\)-value since, the \(p\)-value is stored as \(-log(p)\) in the resulting data frame.
ldl <- VariantAnnotation::readVcf("example_data/ebi-a-GCST002222.vcf.gz") %>%
gwasvcf::vcf_to_granges() %>%
dplyr::as_tibble() %>%
dplyr::mutate(p = exp(-LP))
cad <- VariantAnnotation::readVcf("example_data/ebi-a-GCST005194.vcf.gz") %>%
gwasvcf::vcf_to_granges() %>%
dplyr::as_tibble() %>%
dplyr::mutate(p = exp(-LP))
These commands may take several minutes.
Now we need to merge the data sets. Because the IEU data are all in the same format, the command below will work for any data sets.
X <- gwas_merge(ldl, cad, snp_name_cols = c("ID", "ID"),
beta_hat_cols = c("ES", "ES"),
se_cols = c("SE", "SE"),
A1_cols = c("ALT", "ALT"),
A2_cols = c("REF", "REF"),
pval_cols = c("p", "p"))
From here, the analysis follows the same path as used for data from a flat file. You can pick up at step 2 in that document.
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 whisker_0.4 knitr_1.33 magrittr_2.0.1
[5] R6_2.5.1 rlang_0.4.12 fastmap_1.1.0 fansi_0.5.0
[9] stringr_1.4.0 tools_4.1.1 xfun_0.24 utf8_1.2.2
[13] git2r_0.28.0 htmltools_0.5.2 ellipsis_0.3.2 rprojroot_2.0.2
[17] yaml_2.2.1 digest_0.6.28 tibble_3.1.5 lifecycle_1.0.1
[21] crayon_1.4.1 later_1.3.0 vctrs_0.3.8 promises_1.2.0.1
[25] fs_1.5.0 glue_1.4.2 evaluate_0.14 rmarkdown_2.9
[29] stringi_1.7.5 compiler_4.1.1 pillar_1.6.4 httpuv_1.6.1
[33] pkgconfig_2.0.3