<p>An alternative possibility in R is using the library biomaRt from Bioconductor. Here an example starting from a table with 3 columns: Chr, Start, End. Organism is human and positions are assumed to be based on the reference version GRCh38.</p>
<pre><code>library(biomaRt)
snpMart = useEnsembl(biomart = &quot;snps&quot;, 
         dataset = &quot;hsapiens_snp&quot;)

# assuming your table is tab-separated, with column names
myData &lt;- read.table(&quot;myTable.txt&quot;, sep=&quot;\t&quot;, header=True)

coords &lt;- apply(myData, 1, paste, collapse = &quot;:&quot;)


# submit the query
getBM(attributes = c('refsnp_id', 'chr_name', 'chrom_start', 'chrom_end', 'allele'),
filters = c('chromosomal_region'), 
values = coords, 
mart = snpMart)  
</code></pre>
<p><a href="https://support.bioconductor.org/p/133105/" rel="nofollow noreferrer">Source</a></p>

CC BY-SA 4.0
2023-01-13T12:21:08.473Z
Thank you for suggestion. I have tried this before but getting time-out error even for 500 SNPs. Error in curl::curl_fetch_memory(url, handle = handle) : 
  Timeout was reached: [www.ensembl.org:443] Operation timed out after 300001 milliseconds with 0 bytes received
Jyoti Sharma 
CC BY-SA 4.0
2023-01-16T12:10:51.707Z
@JyotiSharma please show us the actual code you used. An obvious thing to try is 1) just 1 snp, does that work? ii) batch requests: split your list into groups of 20 or 50 or 100 variants and see if that works.
terdon
CC BY-SA 4.0
2023-01-13T10:06:49.087Z
2023-01-13T10:06:49.087Z
JRodrigoF
<p>I have 5609 chromosome positions with both ref and alt alleles. I want to retrieve rsIDs for the same. I tried <code>get_rsid_from_position()</code> of the <code>MRutils</code> package in R, but after some time while fetching data from the internet, the cache memory of my system got full, and it froze the system.
Any other way to resolve this issue?</p>
<p>I have 200 GB allotted for the cache memory.</p>

CC BY-SA 4.0
2023-01-17T08:49:00.457Z
Are you sure you are not incurring into an infinite loop?
JRodrigoF
<r><snp><rsid>
Retrieve rsIDs from chromosome positions using MRutils::get_rsid_from_position
# Retrieve rsIDs from chromosome positions using MRutils::get_rsid_from_position

(Asked by: username_0 on 2023-01-13)

I have 5609 chromosome positions with both ref and alt alleles. I want to retrieve rsIDs for the same. I tried `get_rsid_from_position()` of the `MRutils` package in R, but after some time while fetching data from the internet, the cache memory of my system got full, and it froze the system.
Any other way to resolve this issue?

I have 200 GB allotted for the cache memory.

**Tags:** r, snp, rsid
> **Comments:**
> **username_1**: Are you sure you are not incurring into an infinite loop?  

---

## 1 answers

### Answer by username_1 on 2023-01-13. Score: 3

An alternative possibility in R is using the library biomaRt from Bioconductor. Here an example starting from a table with 3 columns: Chr, Start, End. Organism is human and positions are assumed to be based on the reference version GRCh38.
library(biomaRt)
snpMart = useEnsembl(biomart = "snps", 
         dataset = "hsapiens_snp")

# assuming your table is tab-separated, with column names
myData <- read.table("myTable.txt", sep="\t", header=True)

coords <- apply(myData, 1, paste, collapse = ":")


# submit the query
getBM(attributes = c('refsnp_id', 'chr_name', 'chrom_start', 'chrom_end', 'allele'),
filters = c('chromosomal_region'), 
values = coords, 
mart = snpMart)  

Source

> **Comments:**
> **username_0**: Thank you for suggestion. I have tried this before but getting time-out error even for 500 SNPs. Error in curl::curl_fetch_memory(url, handle = handle) :    Timeout was reached: [www.ensembl.org:443] Operation timed out after 300001 milliseconds with 0 bytes received  
> **username_2**: @JyotiSharma please show us the actual code you used. An obvious thing to try is 1) just 1 snp, does that work? ii) batch requests: split your list into groups of 20 or 50 or 100 variants and see if that works.  

---

