Mapping variant rsids to chromosome:position
1
0
Entering edit mode
3.0 years ago
ThePlaintiff ▴ 90

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.2k views
ADD COMMENT
1
Entering edit mode
3.0 years ago
$ 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...

ADD COMMENT

Login before adding your answer.

Traffic: 1208 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6