How to retrieve all variants for a gene using myvariant.info?
1
0
Entering edit mode
5.1 years ago
Jason2 • 0

I really like the information that the myvariant.info tool can provide, namely annotating the SNPs within genes.

I would like to retrieve all of the annotations for a handful of individual genes in R.

For instance, in the example API url http://myvariant.info/v1/query/?q=dbnsfp.genename:BTK can retrieve info for 10 variants (hits). But I know there are 5143 total SNPs in the database.

I was able to use this command for downloading 10 default hits

library(jsonlite)
json_data <- fromJSON("http://myvariant.info/v1/query/?q=dbnsfp.genename:BTK")

I thought using the fetch_all=TRUE would work but the following command to retrieve at least 1000 hits

json_data <- fromJSON("http://myvariant.info/v1/query/?q=dbnsfp.genename:BTK&fetch_all=TRUE")

but it gives me this error

Error in readBin(3L, raw(0), 32768L) : 
  transfer closed with outstanding read data remaining

so my post boils down to 1 or 2 questions depending on if they can be done together:

  1. How can I access all the variants (hits) for a given gene?

  2. How can I download the results into R?

Thanks!

Update:

The following command retrieved 1000 variants just fine, but still looking to retrieve ALL variants.

json_data <- fromJSON("http://myvariant.info/v1/query/?q=BTK&fetch_all=TRUE")
myvariant.info SNP annotation genome gene • 964 views
ADD COMMENT
0
Entering edit mode
5.0 years ago

Use the myvariant package to fetch data from myvariant.info.

ADD COMMENT

Login before adding your answer.

Traffic: 1441 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6