This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Mapping variant rsids to chromosome:position

Is there a tool that maps rsids to their corresponding location on the chromosome based on a genome build? I wrote a function that extracts chromosomal position from ensembl REST API output but I strongly feel that there is an easier way. Here is a function that I wrote in Python

def map_rsid(rsid):
global EnsemblServer
ext = f"/variant_recoder/human/{rsid}?"
r = requests.get(EnsemblServer+ext, headers={ "Content-Type" : "application/json"})

if not r.ok:
    r.raise_for_status()
    sys.exit()
decoded = r.json()
pos_cmplx = decoded[0]['T'].get('hgvsg')[0].split('.')[1:]

chrom = pos_cmplx[0].split(':')[0]
pos = pos_cmplx[1].split('>')[0][:-1]

merged_id = f'{chrom}:{pos}'
return merged_id

This function does what I need but I feel that there must be a simpler way than parsing the json output of a REST request. What I need is a way of passing an rsid and getting back the genomic position based on a given genome assembly.

mapping disgenet id

1 answer

$ mysql  -h  genome-mysql.cse.ucsc.edu -A -u genome -D hg19 -e 'select chrom,chromStart,name from snp141 where name="rs25"'
+-------+------------+------+
| chrom | chromStart | name |
+-------+------------+------+
| chr7  |   11584141 | rs25 |
+-------+------------+------+

or download the whole NCBI vcf for dbsnp and join with your data...

Log in to answer this question.