ramiromagno / gwasrapidd

gwasrapidd: an R package to query, download and wrangle GWAS Catalog data
https://rmagno.eu/gwasrapidd/
Other
89 stars 15 forks source link

Gwascatcollect<-function(gene, chr=xx, start=xx, end=xx) #29

Closed Shicheng-Guo closed 2 years ago

Shicheng-Guo commented 2 years ago

Hi Ramiro,

I am wondering is there any function to collect GWAS records for given gene?

like: Gwascatcollect<-function(gene, chr=xx, start=xx, end=xx)

Thanks.

Shicheng

ramiromagno commented 2 years ago

Hi Shicheng,

Thank you for your question.

The GWAS data in the GWAS Catalog is divided into four "views", or GWAS Catalog Entities: studies, associations, variants and traits.

You may quickly check which functions allow you to get what by which criteria with gwasrapidd's cheatsheet: https://github.com/rstudio/cheatsheets/blob/main/gwasrapidd.pdf.

To search by gene or by genomic location, you have only available the function get_variants(). This will get you variants. But you can then easily use the variant identifiers obtained as a search criterion for getting the related studies and associations.

Here is an example starting with a genomic location:

library(gwasrapidd)

genomic_range_of_interest <-
  list(chromosome = 13,
       start = 32315086,
       end = 32400268)

my_variants <- get_variants(genomic_range = genomic_range_of_interest)
my_studies <- get_studies(variant_id = my_variants@variants$variant_id)

# This step may take a few minutes to complete
my_associations <- get_associations(study_id = my_studies@studies$study_id)

More info at: https://rmagno.eu/gwasrapidd/articles/faq.html#6-how-to-search-for-variants-within-a-certain-genomic-region-.

The function get_variants() also accepts queries by gene name using the gene_name parameter. For example:

get_variants(gene_name = 'BRCA2')
ramiromagno commented 2 years ago

Hi @Shicheng-Guo:

Did my answer above help? May I close this issue?

ramiromagno commented 2 years ago

Closing due to inactivity.