<p>Hi,</p>

<p>I have a Python script which takes as input a list of SNPs, then calls <a href='http://samtools.sourceforge.net/tabix.shtml'><code>tabix</code></a> to retrieve .<em>VCF file and does some stuff with it.
The problem is that i need to manually add (</em>using UCSC genome browser web*) the coordinates of the SNP for tabix to work properly.</p>

<p>Does any one know any simple python API / function / module to easy add this information without having to perform the search manually?</p>

<p>Thanks!</p>

You can do this with <a href='http://pypi.python.org/pypi/cruzdb/'>cruzdb</a>

    from cruzdb import Genome
    import sys
    
    fname = sys.argv[1]
    hg19 = Genome('hg19')
    snp135 = hg19.snp135
    
    for rs in (l.split()[0].rstrip() for l in open(fname) if l.startswith("rs")):
        print snp135.filter_by(name=rs).first()

which takes a file with the rs id's in the first columns and prints out a bed file with the chromosome locations from dbsnp 135.