<p>If your dataset is limited to human SNPs, and you know the list of SNPs, I would advise taking a look at the dedicated <a href="https://api.ncbi.nlm.nih.gov/variation/v0/" rel="nofollow noreferrer">NCBI Variation Services</a>.  This would be one request for each SNP, but if you fire off 1-2 per second, I think you'll be ok.</p>
<p>For example, for rs1490381980, you could try something like:</p>
<pre><code>curl -X GET 'https://api.ncbi.nlm.nih.gov/variation/v0/refsnp/1490381980' \
   | jq '.primary_snapshot_data.placements_with_allele[] | &quot;\(.seq_id) \(.alleles[0].allele.spdi.position)&quot;'
</code></pre>
<p>It would be better to query for the SNP and parse the JSON in python, but <code>jq</code> helps provide an idea of what is possible.</p>
<p>Alternatively, you could download the JSON or VCF data from the <a href="https://ftp.ncbi.nih.gov/snp/latest_release/" rel="nofollow noreferrer">NCBI dbSNP FTP site</a>, and process out the information you need.</p>

CC BY-SA 4.0
2020-09-29T20:56:42.570Z
2020-09-29T20:56:42.570Z
Brad Holmes
<p>So I have the following e-utils api-link:</p>
<blockquote>
<p><a href="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=gene&amp;db=snp&amp;id=5726&amp;retmode=json" rel="nofollow noreferrer">https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=gene&amp;db=snp&amp;id=5726&amp;retmode=json</a></p>
</blockquote>
<p>it returns all the SNP-ids for the gene with the id 5726 as an example. Additionally to the SNP-ids I also need the SNP position and the genomic distance. Also I would need the chromosome but I could query that from the gene as well rather than for each SNP. Do you know how I can add all these informations to the resulting json/xml?</p>
<p>The first one in the resulting list is the SNP with the id 1490381980. Further information about it can be found on dbSNP: <a href="https://www.ncbi.nlm.nih.gov/snp/?term=1490381980%5BUID%5D" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/snp/?term=1490381980%5BUID%5D</a></p>
<p>I really want to avoid creating a request for each single SNP and would prefer to query everything at once. Due to the unavoidable performance-issues. The Tas2R38 doesn't have that many SNPs but there are other genes with way more.</p>

CC BY-SA 4.0
2020-07-03T17:41:57.527Z
Hi @cowboy_patrick could you plase state/clarify what you mean by "to query everything at once. Due to unavoidable performance issues.".
M__
CC BY-SA 4.0
2020-07-04T03:35:54.257Z
It would be great if I could get all the SNPs and their positions with a single api-call for a specified gene. Instead of creating a call for each SNP on the variation services or something similar
Cowboy_Patrick
<snp><phylogenetics><api>
e-utils api: get chromosome position for each snp on a gene
# e-utils api: get chromosome position for each snp on a gene

(Asked by: username_0 on 2020-07-03)

So I have the following e-utils api-link:

> <https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=gene&db=snp&id=5726&retmode=json>

it returns all the SNP-ids for the gene with the id 5726 as an example. Additionally to the SNP-ids I also need the SNP position and the genomic distance. Also I would need the chromosome but I could query that from the gene as well rather than for each SNP. Do you know how I can add all these informations to the resulting json/xml?

The first one in the resulting list is the SNP with the id 1490381980. Further information about it can be found on dbSNP: <https://www.ncbi.nlm.nih.gov/snp/?term=1490381980%5BUID%5D>

I really want to avoid creating a request for each single SNP and would prefer to query everything at once. Due to the unavoidable performance-issues. The Tas2R38 doesn't have that many SNPs but there are other genes with way more.

**Tags:** snp, phylogenetics, api
> **Comments:**
> **username_1**: Hi @cowboy_patrick could you plase state/clarify what you mean by "to query everything at once. Due to unavoidable performance issues.".  
> **username_0**: It would be great if I could get all the SNPs and their positions with a single api-call for a specified gene. Instead of creating a call for each SNP on the variation services or something similar  

---

## 1 answers

### Answer by username_2 on 2020-09-29. Score: 2

If your dataset is limited to human SNPs, and you know the list of SNPs, I would advise taking a look at the dedicated NCBI Variation Services.  This would be one request for each SNP, but if you fire off 1-2 per second, I think you'll be ok.
For example, for rs1490381980, you could try something like:
curl -X GET 'https://api.ncbi.nlm.nih.gov/variation/v0/refsnp/1490381980' \
   | jq '.primary_snapshot_data.placements_with_allele[] | "\(.seq_id) \(.alleles[0].allele.spdi.position)"'

It would be better to query for the SNP and parse the JSON in python, but jq helps provide an idea of what is possible.
Alternatively, you could download the JSON or VCF data from the NCBI dbSNP FTP site, and process out the information you need.


---

