Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reporting the hg19/37 position (if available) in ncbi_snp_query_api() #95

Open
jooolia opened this issue May 12, 2020 · 7 comments · May be fixed by #149
Open

Add support for reporting the hg19/37 position (if available) in ncbi_snp_query_api() #95

jooolia opened this issue May 12, 2020 · 7 comments · May be fixed by #149
Labels

Comments

@jooolia
Copy link
Member

jooolia commented May 12, 2020

As brought up in #92. It would be nice to add support for reporting the hg19/37 position (if available) in ncbi_snp_query_api().

@sinarueeger
Copy link
Contributor

sinarueeger commented May 14, 2020

Test

  aa <- ncbi_snp_query("rs1610720")
  expect_equal(aa$Chromosome, "6")
  expect_equal(aa$BP, 29793285) ## on GRCh38
  expect_equal(aa$BP, 29761062) ## on GRCh37

@arjanboltjes
Copy link

arjanboltjes commented Sep 21, 2020

I needed this function to work with hg19/37, so I had a look at your ncbi_snp_api.R code and the NCBI api output of one of the SNPs in your examples (rs420358), and it seems to me line 8 in your code decides whether you get assembly 38 or 37.
Changing line 8 to:
if (record$is_ptlp == 0 & length(record$placement_annot$seq_id_traits_by_assembly) > 0) {
gives me hg37 output.
I ran this for a list of SNPs of interest that I'm working on, of which I know the chr and bp position, and it nicely yields the hg19/37 output that I would expect, instead of the default hg38 output of the function in your package. The output variable also yields GRCh37.p13 as value.

Looking at some more NCBI api output, within the primary_snapshot_data that you pull the info from, there sometimes are more entries besides hg19/37 and hg38, but as far as I saw these don't pass the second argument of your if call in line 8.

If the above turns out to be correct - I did not thoroughly look into this any further than the above - perhaps you can add an argument to the function this way where you can toggle between hg19/37 and hg38?

As an aside, running this function, especially for a vector of variants, relatively often gives me an error:
Error in curl::curl_fetch_memory(url, handle = handle) : Error in the HTTP2 framing layer
Is this something you see more often with the default function?

@sinarueeger
Copy link
Contributor

@arjanboltjes thanks for your input! Regarding Error in curl::curl_fetch_memory(url, handle = handle) : Error in the HTTP2 framing layer - can you replicate the error with a particular set of SNPs, or does it occur randomly? In any case, could you file an issue for that?

@VangelisTheodorakis
Copy link

Yes this would be super useful! Should we expect a fix soon?

@cruzpazv
Copy link

cruzpazv commented Mar 1, 2022

I made a fork and try to solve this problem, check in: https://github.com/cruzpazv/rsnps/blob/master/R/ncbi_snp_api.R
By default ncbi_snp_query as version GRCh38. For version GRCh37, add to the function like this: ncbi_snp_query(snps, version = "37").

@jooolia
Copy link
Member Author

jooolia commented Mar 2, 2022

Thanks @cruzpazv we will try to have a look at your solution this week.

@sinarueeger
Copy link
Contributor

Thanks @cruzpazv. Could you make a pull request so we can easily check the changes you made in your fork?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants