BiocStyle::markdown()
knitr::opts_chunk$set(tidy = FALSE,
                      message = FALSE)
library(echodata)

The *echolocatoR.

The following functions provides API access to the fine-mapping results, pre-computed LD matrices, and plots available on the echolocatoR Fine-mapping Portal.

View metadata

Peruse the metadata to see the available data types (e.g. "GWAS", "QTL"), datasets (e.g. "Ripke_2014", "Wray_2018"), and phenotypes (e.g. "Schizophrenia", "Major Depressive Disorder").

meta <- echodata::portal_metadata()
knitr::kable(meta)

Query portal

Query and download data from the echolocatoR Fine-mapping Portal.

portal_query will return a list of paths where each file has been downloaded locally, in a hierarchical folder structure (i.e. dataset_type --> dataset --> locus --> data_types )

results_dir <- tempdir()
local_files <- echodata::portal_query(dataset_types="GWAS",
                                      phenotypes = c("schizophrenia",
                                                     "parkinson"),
                                      file_types = c("multi_finemap","LD"),
                                      loci = c("BST1","CHRNB1","LRRK2"),
                                      LD_panels = "UKB",
                                      results_dir = results_dir)
knitr::kable(utils::head(local_files))

Merge fine-mapping results

Next, we can gather all of the fine-mapping results generated by finemap_loci() previously.
merge_finemapping_results recursively searches for the correct files within a hierarchical folder structure and imports only the multi-finemap files.

merged_DT <- echodata::merge_finemapping_results(dataset = results_dir,   
                                                 minimum_support = 0,
                                                 include_leadSNPs = TRUE,
                                                 consensus_thresh = 2)
echodata::results_report(merged_DT)
knitr::kable(utils::head(merged_DT))

Import LD

Next, we import the a subset of the LD matrices for only the lead SNP.

ld_files <- local_files[file_type=="LD",]
ld_matrices <- lapply(stats::setNames(ld_files$path_local, 
                                      ld_files$locus),
                      function(x){
  data.table::fread(x)
}) 
knitr::kable(utils::head(ld_matrices[[1]]))

Session Info

utils::sessionInfo()



RajLabMSSM/echodata documentation built on Nov. 21, 2023, 8 a.m.