Title: | Interface Package for the 'EpiGraphDB' Platform |
---|---|
Description: | The interface package to access data from the 'EpiGraphDB' <https://epigraphdb.org> platform. It provides easy access to the 'EpiGraphDB' platform with functions that query the corresponding REST endpoints on the API <https://api.epigraphdb.org> and return the response data in the 'tibble' data frame format. |
Authors: | Yi Liu [cre, aut], Valeriia Haberland [aut], Marina Vabistsevits [aut], Tom Gaunt [aut], MRC IEU [cph] |
Maintainer: | Yi Liu <[email protected]> |
License: | GPL-3 |
Version: | 0.2.3 |
Built: | 2025-01-09 05:26:43 UTC |
Source: | https://github.com/MRCIEU/epigraphdb-r |
confounder( exposure_trait = NULL, outcome_trait = NULL, type = c("confounder", "intermediate", "reverse_intermediate", "collider"), pval_threshold = 1e-05, mode = c("table", "raw") )
confounder( exposure_trait = NULL, outcome_trait = NULL, type = c("confounder", "intermediate", "reverse_intermediate", "collider"), pval_threshold = 1e-05, mode = c("table", "raw") )
exposure_trait |
A trait name, e.g. "Body mass index",
leaving |
outcome_trait |
A trait name, e.g. "Coronary heart disease",
leaving |
type |
One in |
pval_threshold |
P-value threshold |
mode |
If |
Data from GET /confounder
## Not run: confounder(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease") ## End(Not run)
## Not run: confounder(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease") ## End(Not run)
NOTE: this function is intended for advanced uses. Regular users are recommended to use standard query functions
cypher(query, mode = c("table", "raw"))
cypher(query, mode = c("table", "raw"))
query |
A Cypher query. |
mode |
If |
## Not run: cypher("MATCH (n:Gwas) RETURN n LIMIT 2") ## End(Not run)
## Not run: cypher("MATCH (n:Gwas) RETURN n LIMIT 2") ## End(Not run)
drugs_risk_factors(trait, pval_threshold = 1e-08, mode = c("table", "raw"))
drugs_risk_factors(trait, pval_threshold = 1e-08, mode = c("table", "raw"))
trait |
A trait name |
pval_threshold |
P-value threshold |
mode |
If |
Data from GET /drugs/risk-factors
## Not run: drugs_risk_factors(trait = "Body mass index") ## End(Not run)
## Not run: drugs_risk_factors(trait = "Body mass index") ## End(Not run)
genetic_cor(trait, cor_coef_threshold = 0.8, mode = c("table", "raw"))
genetic_cor(trait, cor_coef_threshold = 0.8, mode = c("table", "raw"))
trait |
name of the trait, e.g. "body mass index" |
cor_coef_threshold |
correlation coefficient threshold |
mode |
If |
Data from GET /genetic_cor
## Not run: genetic_cor(trait = "Body mass index") %>% dplyr::glimpse() ## End(Not run) # Use a different threshold ## Not run: genetic_cor(trait = "Body mass index", cor_coef_threshold = 0.4) %>% dplyr::glimpse() ## End(Not run)
## Not run: genetic_cor(trait = "Body mass index") %>% dplyr::glimpse() ## End(Not run) # Use a different threshold ## Not run: genetic_cor(trait = "Body mass index", cor_coef_threshold = 0.4) %>% dplyr::glimpse() ## End(Not run)
literature_gwas(trait, semmed_predicate = NULL, mode = c("table", "raw"))
literature_gwas(trait, semmed_predicate = NULL, mode = c("table", "raw"))
trait |
A trait name |
semmed_predicate |
Either NULL which returns entries from all predicates, or a SemMed predicate e.g. "DIAGNOSES" or "ASSOCIATED_WITH" |
mode |
If |
Data from GET /literature/gwas
## Not run: literature_gwas(trait = "Body mass index") ## End(Not run)
## Not run: literature_gwas(trait = "Body mass index") ## End(Not run)
POST /mappings/gene-to-protein
mappings_gene_to_protein( gene_name_list = NULL, gene_id_list = NULL, by_gene_id = FALSE, mode = c("table", "raw") )
mappings_gene_to_protein( gene_name_list = NULL, gene_id_list = NULL, by_gene_id = FALSE, mode = c("table", "raw") )
gene_name_list |
List of HGNC symbols of the genes (default) |
gene_id_list |
List of Ensembl gene IDs (when |
by_gene_id |
Search for gene ids (Ensembl gene IDs) instead of gene names (HGNC symbols) |
mode |
If |
Data from POST /mappings/gene-to-protein
# By HGNC symbols ## Not run: mappings_gene_to_protein(gene_name_list = c("GCH1", "MYOF")) ## End(Not run) # By Enselbl Ids ## Not run: mappings_gene_to_protein(gene_id_list = c("ENSG00000162594", "ENSG00000113302"), by_gene_id = TRUE) ## End(Not run)
# By HGNC symbols ## Not run: mappings_gene_to_protein(gene_name_list = c("GCH1", "MYOF")) ## End(Not run) # By Enselbl Ids ## Not run: mappings_gene_to_protein(gene_id_list = c("ENSG00000162594", "ENSG00000113302"), by_gene_id = TRUE) ## End(Not run)
meta_nodes_list(mode = c("raw"))
meta_nodes_list(mode = c("raw"))
mode |
If |
Data from GET /meta/nodes/list
## Not run: meta_nodes_list() ## End(Not run)
## Not run: meta_nodes_list() ## End(Not run)
GET /meta/nodes/{meta_node}/list
meta_nodes_list_node( meta_node, full_data = TRUE, limit = 10, offset = 0, mode = c("table", "raw") )
meta_nodes_list_node( meta_node, full_data = TRUE, limit = 10, offset = 0, mode = c("table", "raw") )
meta_node |
Name of a meta node (e.g. Gwas). Use |
full_data |
When False, only return the id and name fields (their specific names differ in specific nodes) for a node. This is useful if you want your queries to return results faster with smaller amount of data requested. |
limit |
Max number of items to retrieve. |
offset |
Number of items to skip. Use |
mode |
If |
Data from GET /meta/nodes/{meta_node}/list
# List the first 5 Gwas nodes, with only id and name fields ## Not run: meta_nodes_list_node(meta_node = "Gwas", full_data = FALSE, limit = 5) ## End(Not run) # List the 6th - 10th Disease nodes, with full properties ## Not run: meta_nodes_list_node(meta_node = "Disease", full_data = TRUE, limit = 5, offset = 0) ## End(Not run)
# List the first 5 Gwas nodes, with only id and name fields ## Not run: meta_nodes_list_node(meta_node = "Gwas", full_data = FALSE, limit = 5) ## End(Not run) # List the 6th - 10th Disease nodes, with full properties ## Not run: meta_nodes_list_node(meta_node = "Disease", full_data = TRUE, limit = 5, offset = 0) ## End(Not run)
GET /meta/nodes/{meta_node}/search
meta_nodes_search_node( meta_node, id = NULL, name = NULL, limit = 10, full_data = TRUE, mode = c("table", "raw") )
meta_nodes_search_node( meta_node, id = NULL, name = NULL, limit = 10, full_data = TRUE, mode = c("table", "raw") )
meta_node |
Name of a meta node (e.g. Gwas). Use |
id |
The id field of a node (e.g. "ieu-a-2" for a Gwas). Use EpiGraphDB web UI to get a sense of what those ids are for entities. |
name |
The name field of a node (e.g. "body mass index" for a Gwas). Use EpiGraphDB web UI to get a sense of what those names are for entities. |
limit |
Max number of items to retrieve. |
full_data |
When False, only return the id and name fields (their specific names differ in specific nodes) for a node. This is useful if you want your queries to return results faster with smaller amount of data requested. |
mode |
If |
Data from GET /meta/nodes/{meta_node}/search
# Search Gwas nodes ## Not run: meta_nodes_search_node(meta_node = "Gwas", name = "body mass index") ## End(Not run)
# Search Gwas nodes ## Not run: meta_nodes_search_node(meta_node = "Gwas", name = "body mass index") ## End(Not run)
meta_rels_list(mode = c("raw"))
meta_rels_list(mode = c("raw"))
mode |
If |
Data from GET /meta/rels/list
## Not run: meta_rels_list() ## End(Not run)
## Not run: meta_rels_list() ## End(Not run)
GET /meta/rels/{meta_rel}/list
meta_rels_list_rel(meta_rel, limit = 10, offset = 0, mode = c("table", "raw"))
meta_rels_list_rel(meta_rel, limit = 10, offset = 0, mode = c("table", "raw"))
meta_rel |
Name of a meta relationship (e.g. MR). Use |
limit |
Max number of items to retrieve. |
offset |
Number of items to skip. Use |
mode |
If |
Data from GET /meta/rels/{meta_rel}/list
# List the first 5 MR relationships ## Not run: meta_rels_list_rel(meta_rel = "MR_EVE_MR", limit = 5) ## End(Not run)
# List the first 5 MR relationships ## Not run: meta_rels_list_rel(meta_rel = "MR_EVE_MR", limit = 5) ## End(Not run)
mr( exposure_trait = NULL, outcome_trait = NULL, pval_threshold = 1e-05, mode = c("table", "raw") )
mr( exposure_trait = NULL, outcome_trait = NULL, pval_threshold = 1e-05, mode = c("table", "raw") )
exposure_trait |
A trait name, e.g. "Body mass index",
leaving |
outcome_trait |
A trait name, e.g. "Coronary heart disease",
leaving |
pval_threshold |
P-value threshold |
mode |
If |
Data from GET /mr
# Returns a data frame ## Not run: mr(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease") ## End(Not run) # Returns raw response ## Not run: mr( exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease", mode = "raw" ) %>% str() ## End(Not run) # Use a different threshold ## Not run: mr(exposure_trait = "Body mass index", pval_threshold = 1e-8) ## End(Not run)
# Returns a data frame ## Not run: mr(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease") ## End(Not run) # Returns raw response ## Not run: mr( exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease", mode = "raw" ) %>% str() ## End(Not run) # Use a different threshold ## Not run: mr(exposure_trait = "Body mass index", pval_threshold = 1e-8) ## End(Not run)
obs_cor(trait, cor_coef_threshold = 0.8, mode = c("table", "raw"))
obs_cor(trait, cor_coef_threshold = 0.8, mode = c("table", "raw"))
trait |
name of the trait, e.g. "body mass index" |
cor_coef_threshold |
correlation coefficient threshold |
mode |
If |
Data from GET /obs-cor
## Not run: obs_cor(trait = "Body mass index (BMI)") %>% dplyr::glimpse() ## End(Not run) # Use a different threshold ## Not run: obs_cor(trait = "Body mass index (BMI)", cor_coef_threshold = 0.8) %>% dplyr::glimpse() ## End(Not run)
## Not run: obs_cor(trait = "Body mass index (BMI)") %>% dplyr::glimpse() ## End(Not run) # Use a different threshold ## Not run: obs_cor(trait = "Body mass index (BMI)", cor_coef_threshold = 0.8) %>% dplyr::glimpse() ## End(Not run)
ontology_gwas_efo( trait = NULL, efo_term = NULL, fuzzy = TRUE, mode = c("table", "raw") )
ontology_gwas_efo( trait = NULL, efo_term = NULL, fuzzy = TRUE, mode = c("table", "raw") )
trait |
trait name, e.g. "body mass" |
efo_term |
EFO term, e.g. "systolic blood pressure" |
fuzzy |
whether query with exact matching (FALSE) or fuzzy matching (default, TRUE) |
mode |
If |
Data from GET /ontology/gwas-efo
## Not run: ontology_gwas_efo(trait = "blood", fuzzy = FALSE) ## End(Not run) ## Not run: ontology_gwas_efo(efo_term = "blood pressure", fuzzy = FALSE) ## End(Not run)
## Not run: ontology_gwas_efo(trait = "blood", fuzzy = FALSE) ## End(Not run) ## Not run: ontology_gwas_efo(efo_term = "blood pressure", fuzzy = FALSE) ## End(Not run)
pathway(trait, pval_threshold = 1e-05, mode = c("table", "raw"))
pathway(trait, pval_threshold = 1e-05, mode = c("table", "raw"))
trait |
A trait name |
pval_threshold |
P-value threshold |
mode |
If |
Data from GET /pathway
## Not run: pathway(trait = "Body mass index") ## End(Not run)
## Not run: pathway(trait = "Body mass index") ## End(Not run)
pqtl( query, rtype = c("mrres", "simple", "sglmr", "inst", "sense"), pvalue = 0.05, searchflag = c("traits", "proteins"), mode = c("table", "raw") )
pqtl( query, rtype = c("mrres", "simple", "sglmr", "inst", "sense"), pvalue = 0.05, searchflag = c("traits", "proteins"), mode = c("table", "raw") )
query |
(Required) A protein coding gene name or a trait name,
e.g. "ADAM19" or "Inflammatory bowel disease"
which cannot be |
rtype |
(Optional) A type of data to be extracted, which can be one of these options:
|
pvalue |
(Optional) A pvalue threshold for MR results with the DEFAULT set to 0.05.
NOTE: this threshold applies to any |
searchflag |
(Required) A flag to indicate whether you are searching for proteins or
traits which cannot be |
mode |
If |
Data from GET /pqtl/
# Returns a data frame of MR results, while searching for proteins ## Not run: pqtl(query = "ADAM19", searchflag = "proteins") ## End(Not run) # Returns a data frame with SNP information, while searching for traits ## Not run: pqtl( query = "Inflammatory bowel disease", rtype = "inst", searchflag = "traits" ) ## End(Not run) # Change a pvalue threshold (the default is 0.05) ## Not run: pqtl( query = "Inflammatory bowel disease", rtype = "inst", pvalue = 1.0, searchflag = "traits" ) ## End(Not run) # Returns raw response if mode="raw" ## Not run: pqtl( query = "ADAM19", searchflag = "proteins", mode = "raw" ) %>% str() ## End(Not run)
# Returns a data frame of MR results, while searching for proteins ## Not run: pqtl(query = "ADAM19", searchflag = "proteins") ## End(Not run) # Returns a data frame with SNP information, while searching for traits ## Not run: pqtl( query = "Inflammatory bowel disease", rtype = "inst", searchflag = "traits" ) ## End(Not run) # Change a pvalue threshold (the default is 0.05) ## Not run: pqtl( query = "Inflammatory bowel disease", rtype = "inst", pvalue = 1.0, searchflag = "traits" ) ## End(Not run) # Returns raw response if mode="raw" ## Not run: pqtl( query = "ADAM19", searchflag = "proteins", mode = "raw" ) %>% str() ## End(Not run)
pqtl_list(flag = c("exposures", "outcomes"), mode = c("table", "raw"))
pqtl_list(flag = c("exposures", "outcomes"), mode = c("table", "raw"))
flag |
(Optional) A flag which indicates whether the list of exposures (if "exposures") or outcomes (if "outcomes") should be returned. The DEFAULT is "exposures". |
mode |
If |
Data from GET /pqtl/list/
# Returns a list of available proteins (exposures) ## Not run: pqtl_list() ## End(Not run) # Returns a list of available traits (outcomes) ## Not run: pqtl_list(flag = "outcomes") ## End(Not run)
# Returns a list of available proteins (exposures) ## Not run: pqtl_list() ## End(Not run) # Returns a list of available traits (outcomes) ## Not run: pqtl_list(flag = "outcomes") ## End(Not run)
pqtl_pleio( rsid = NULL, prflag = c("proteins", "count"), mode = c("table", "raw") )
pqtl_pleio( rsid = NULL, prflag = c("proteins", "count"), mode = c("table", "raw") )
rsid |
(Required) A SNP identified by rsID which cannot be |
prflag |
(Optional) A flag which determines whether the number (if "count") or names (if "proteins") of the associated proteins should be returned. The DEFAULT value is "proteins". |
mode |
(Optional) If |
Data from GET /pqtl/pleio/
# Returns a data frame of associated proteins ## Not run: pqtl_pleio(rsid = "rs1260326") ## End(Not run) # Returns a number of associated proteins ## Not run: pqtl_pleio(rsid = "rs1260326", prflag = "count") ## End(Not run)
# Returns a data frame of associated proteins ## Not run: pqtl_pleio(rsid = "rs1260326") ## End(Not run) # Returns a number of associated proteins ## Not run: pqtl_pleio(rsid = "rs1260326", prflag = "count") ## End(Not run)
protein_in_pathway(uniprot_id_list, mode = c("table", "raw"))
protein_in_pathway(uniprot_id_list, mode = c("table", "raw"))
uniprot_id_list |
A list of protein UniProt IDs |
mode |
If |
Data from POST /protein/in-pathway
## Not run: protein_in_pathway(uniprot_id_list = c("014933", "060674", "P32455")) ## End(Not run)
## Not run: protein_in_pathway(uniprot_id_list = c("014933", "060674", "P32455")) ## End(Not run)
This is a general purpose function to send data request
which can be used when there has not been an R equivalent package function
to an API endpoint.
Underneath this is a wrapper around httr
functions with better handling of
returned status.
query_epigraphdb( route, params = NULL, mode = c("raw", "table"), method = c("GET", "POST"), retry_times = 3, retry_pause_min = 1 )
query_epigraphdb( route, params = NULL, mode = c("raw", "table"), method = c("GET", "POST"), retry_times = 3, retry_pause_min = 1 )
route |
An EpiGraphDB API endpoint route, e.g. |
params |
A list of parameters associated with the query endpoint. |
mode |
|
method |
Type of HTTP (GET, POST, PUT, etc.) method. NOTE: When sending a POST request where a specific parameter is specified as a list on the API,
and if the equivalent in R is a vector of length 1, you should wrap this parameter
in |
retry_times |
Number of times the function will retry the request to the API. |
retry_pause_min |
Minimum number of seconds to wait for the next retry. |
Data from an EpiGraphDB API endpoint.
# GET /mr # equivalent to `mr(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease")` ## Not run: query_epigraphdb( route = "/mr", params = list( exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease" ), mode = "table" ) ## End(Not run) # GET /meta/nodes/Gwas/list ## Not run: query_epigraphdb( route = "/meta/nodes/Gwas/list", params = list( limit = 5, offset = 0 ) ) %>% str(1) ## End(Not run) # POST /protein/ppi ## Not run: query_epigraphdb( route = "/protein/ppi", params = list( uniprot_id_list = c("P30793", "Q9NZM1", "O95236") ), method = "POST" ) ## End(Not run) # error handling ## Not run: tryCatch( query_epigraphdb( route = "/mr", params = list( exposure_trait = NULL, outcome_trait = NULL ), retry_times = 0 ), error = function(e) { message(e) } ) ## End(Not run)
# GET /mr # equivalent to `mr(exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease")` ## Not run: query_epigraphdb( route = "/mr", params = list( exposure_trait = "Body mass index", outcome_trait = "Coronary heart disease" ), mode = "table" ) ## End(Not run) # GET /meta/nodes/Gwas/list ## Not run: query_epigraphdb( route = "/meta/nodes/Gwas/list", params = list( limit = 5, offset = 0 ) ) %>% str(1) ## End(Not run) # POST /protein/ppi ## Not run: query_epigraphdb( route = "/protein/ppi", params = list( uniprot_id_list = c("P30793", "Q9NZM1", "O95236") ), method = "POST" ) ## End(Not run) # error handling ## Not run: tryCatch( query_epigraphdb( route = "/mr", params = list( exposure_trait = NULL, outcome_trait = NULL ), retry_times = 0 ), error = function(e) { message(e) } ) ## End(Not run)
xqtl_multi_snp_mr( exposure_gene = NULL, outcome_trait = NULL, mr_method = c("IVW", "Egger"), qtl_type = c("eQTL", "pQTL"), pval_threshold = 1e-05, mode = c("table", "raw") )
xqtl_multi_snp_mr( exposure_gene = NULL, outcome_trait = NULL, mr_method = c("IVW", "Egger"), qtl_type = c("eQTL", "pQTL"), pval_threshold = 1e-05, mode = c("table", "raw") )
exposure_gene |
Name of the exposure gene |
outcome_trait |
Name of the outcome trait |
mr_method |
"IVW" or "Egger" |
qtl_type |
"eQTL" or "pQTL" |
pval_threshold |
P-value threshold |
mode |
If |
Data from GET /xqtl/multi-snp-mr
## Not run: xqtl_multi_snp_mr(outcome_trait = "Coronary heart disease") ## End(Not run)
## Not run: xqtl_multi_snp_mr(outcome_trait = "Coronary heart disease") ## End(Not run)
xqtl_single_snp_mr( exposure_gene = NULL, outcome_trait = NULL, snp = NULL, qtl_type = c("eQTL", "pQTL"), pval_threshold = 1e-05, mode = c("table", "raw") )
xqtl_single_snp_mr( exposure_gene = NULL, outcome_trait = NULL, snp = NULL, qtl_type = c("eQTL", "pQTL"), pval_threshold = 1e-05, mode = c("table", "raw") )
exposure_gene |
Name of the exposure gene |
outcome_trait |
Name of the outcome trait |
snp |
SNP rsid |
qtl_type |
"eQTL" or "pQTL" |
pval_threshold |
P-value threshold |
mode |
If |
Data from GEET /xqtl/single-snp-mr
## Not run: xqtl_single_snp_mr(outcome_trait = "Coronary heart disease") ## End(Not run)
## Not run: xqtl_single_snp_mr(outcome_trait = "Coronary heart disease") ## End(Not run)