knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(rms2) # library(devtools) # load_all()
Create new rms2 class for the outcome GWAS of interest
x <- rms2$new("ukb-b-2227")
Get the GWAS hits for that dataset
x$extract_gwashits() x$gwashits
Scan OpenGWAS for associations with the second GWAS hit
x$scan_rsid(x$gwashits$rsid[2]) x$rsid_scan
Perform colocalisation for each of the candidate associations
x$coloc_scan(x$gwashits$rsid[2]) x$coloc_result
Example of plotting a region (extracts LD matrix)
x$plot_coloc(x$gwashits$rsid[2], x$rsid_scan[[x$gwashits$rsid[2]]]$id[1])
Perform MR for all the candidate traits (though could also exclude the traits that don't colocalise)
x$mr(x$gwashits$rsid[2], exclude_rsid_region=TRUE) x$mr_scan[[x$gwashits$rsid[2]]] %>% dplyr::select(exposure, b, se, pval)
Perform multivariable MR of candidate traits. Excluding the alternative GWAS of number of children fathered as this is synonymous with the outcome
x$mvmr(x$gwashits$rsid[2], traitlist=x$rsid_scan[[x$gwashits$rsid[2]]]$id[-5]) x$mv_dat[[x$gwashits$rsid[2]]][["result"]][[1]] %>% dplyr::select(exposure, b, se, pval)
Perform feature selection and re-estimate associations after that. It updates the result from the standard MVMR analysis
x$mvmr_lasso(x$gwashits$rsid[2]) x$mv_dat[[x$gwashits$rsid[2]]][["result"]][[1]] %>% dplyr::select(exposure, b, se, pval)
Note that this might lead to under-estimated standard errors so it should be used for estimation rather than hypothesis testing
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.