Attempt to make ncbi_snp_query() compatible with version GRCh37
Description
Split in two with if the function get_placement() to obtain the result from the json related with the version choose. Create a new function called get_placement_inside() with the code that was inside the get_placement() function before to be call by it in the two different options of the if. By default will be GRCh38, and if you want the version GRCh37, you must specify in the parameters of ncbi_snp_query() as: ncbi_snp_query(snps, "37"). Update example in README.
Related Issue
Fix #95
Example
install.packages("remotes") remotes::install_github("cruzpazv/rsnps") install.packages("tinytest")
library(rsnps) library(tinytest)
Example for GRCh38 example_38 <- ncbi_snp_query("rs8192675") expect_equal(example_38$chromosome, "3") expect_equal(example_38$bp, 171007094) ## on GRCh38
Example for GRCh37 example_37 <- ncbi_snp_query("rs8192675", "37") expect_equal(example_37$chromosome, "3") expect_equal(example_37$bp, 170724883) ## on GRCh37
Running code
> library(rsnps)
> library(tinytest)
# Example for GRCh38
> example_38 <- ncbi_snp_query("rs8192675")
Getting info about the following rsIDs: rs8192675
> expect_equal(example_38$chromosome, "3")
----- PASSED : <-->
call| expect_equal(example_38$chromosome, "3")
> expect_equal(example_38$bp, 171007094) ## on GRCh38
----- PASSED : <-->
call| expect_equal(example_38$bp, 171007094)
# Example for GRCh37
> example_37 <- ncbi_snp_query("rs8192675", "37")
Getting info about the following rsIDs: rs8192675
> expect_equal(example_37$chromosome, "3")
----- PASSED : <-->
call| expect_equal(example_37$chromosome, "3")
> expect_equal(example_37$bp, 170724883) ## on GRCh37
----- PASSED : <-->
call| expect_equal(example_37$bp, 170724883)
Dear @cruzpazv, First off, thanks a lot for your PR. I think it looks like a good approach. I haven't yet had a in-depth look, but I have a few small comments here right now and will add a few more comments in-line a bit later.
- Could you change the PR to point to dev instead of master?
- I tested running
ncbi_snp_query("rs8192675", "19")and it fails (as it should ) without any info. I think we could improve the error handling here and add info for the users. I will comment in the code.
Thanks! Julia
Dear @jooolia, thank you for your comments. Currently and in the coming months I will not have much time availability and I will not be able to make the changes you mention. But feel free to do them if you really want to. Sorry for the inconvenience.
The only change I could make is to change the PR to point to dev instead of master. @jooolia
Hi @cruzpazv, Thanks for your work and sorry for the slow reply. I will get back to this soon and try to incorporate your suggestions. For the moment I will leave this PR open.