Comments (3)
Hi Liz,
One variant can be implicated in many associations and each association associated with a single trait. Because the mapping from variants to associations is one to many, in {gwasrapidd}
we have to take this path of mapping from variants to associations to traits explicitly... In the future I might implement this in a more straightforward way for the user (apologies for that!).
For the moment the following code should do the trick:
library(gwasrapidd)
library(tidyverse)
# Adapt `my_variants` to be a vector of your variants
my_variants <- c("rs7329174", "rs3798440")
my_variants <- setNames(my_variants, nm = my_variants)
lst <- purrr::map(my_variants, ~ get_associations(variant_id = .x)@associations[, "association_id"])
var_to_assoc <- purrr::list_rbind(lst, names_to = "variant_id")
my_associations <- var_to_assoc$association_id
my_associations <- setNames(my_associations, nm = my_associations)
lst2 <- purrr::map(my_associations, ~ get_traits(association_id = .x)@traits[, c("efo_id", "trait")])
assoc_to_trait <- purrr::list_rbind(lst2, names_to = "association_id")
left_join(var_to_assoc, assoc_to_trait, by = "association_id")
#> # A tibble: 7 × 4
#> variant_id association_id efo_id trait
#> <chr> <chr> <chr> <chr>
#> 1 rs7329174 16617 MONDO_0007915 systemic lupus erythematosus
#> 2 rs7329174 26451 EFO_0000384 crohn's disease
#> 3 rs7329174 26394 MONDO_0007915 systemic lupus erythematosus
#> 4 rs7329174 92481688 MONDO_0007915 systemic lupus erythematosus
#> 5 rs7329174 17433639 MONDO_0007915 systemic lupus erythematosus
#> 6 rs7329174 103267749 EFO_0004339 body height
#> 7 rs3798440 24299710 EFO_0000537 hypertension
from gwasrapidd.
from gwasrapidd.
You're welcome!
from gwasrapidd.
Related Issues (20)
- Response code 500 when using get_studies() HOT 8
- parsing issue while using get_variants() HOT 10
- Gwascatcollect<-function(gene, chr=xx, start=xx, end=xx) HOT 3
- GRASP: Genome-Wide Repository of Associations Between SNPs and Phenotypes HOT 4
- The most efficient way to retrieve association results by study_id? HOT 2
- institutional logo not rendered in footer
- revisit FAQ 5 HOT 1
- consider transitioning to the (not so) new pkgdown website template HOT 2
- Error: parse error: premature EOF in study responses
- Response code was 500. HOT 3
- About failing download the studies of "get_studies()“ HOT 6
- Error when running get_associations() HOT 4
- Problem with obtaining the RAF for individual variants contained within associations with a haplotype
- Why are some gene names present in `genomic_contexts` but not in `ensembl_ids`? HOT 7
- The associations number obtained by "gwasrapidd" differs extremly from obtained in GWAS Catalog HOT 5
- How do I export `my_associations` to a table file, separated by tabs HOT 8
- FR: Add export functionality for gwasrapidd objects: `write_xlsx()`
- `get_studies()` not returning a scores object with efo id `"MONDO_0004648"`
- How download TSV file like on the web GWAS Catalog?or any function can do like that? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwasrapidd.