def test_get_multiple(self): ids = ','.join(['chr16:g.28883241A>G', 'chr1:g.35367G>A']) res = Variant.get_multiple(ids=ids) self.assertTrue(res is not None) for r in res: self.assertTrue(r._id in ids)
def test_get(self): res = Variant.get('chr1:g.35367G>A') self.assertTrue(res is not None) self.assertEqual(res.cadd['chrom'], 1)
def test_find_multiple_by(self): rsids = ','.join(['rs58991260', 'rs2500']) res = Variant.find_multiple_by(q=rsids, scopes='dbsnp.rsid') for r in res: self.assertTrue(r.dbsnp['rsid'] in rsids)
def test_find_by(self): res = Variant.find_by(q='chr1:69000-70000') self.assertEqual(len(res), 3) for r in res: self.assertEqual(r.cadd['chrom'], 1)
outfile="/Users/gerikson/Desktop/CognitiveSNPs/snpID_positiona.txt" inf = open(infile) outf = open(outfile, 'w') diff_coordinates = 0 counter = 0 #desease = "" for line in inf: #print line #p_line = line.split("\t") #rsID = tp_line[0] rsID = line.strip() #print rsID try: counter += 1 results = Variant.find_by(q=rsID) for r in results: #print r._id begin = r.dbsnp['hg19']['start'] temp_id = r._id temp_id1 = temp_id.split(":") chrom = temp_id1[0] outf.write(rsID + "\t" + chrom+"\t" +str(begin)+"\n") except: print "Not Found " + rsID outf.write(rsID) continue #print desease print "Total variants found " + str(counter)
outfile="/Users/gerikson/Desktop/CognitiveSNPs/RegionalPlots/RegionalPlotData_correctSnps.txt" inf = open(infile) outf = open(outfile, 'w') diff_coordinates = 0 counter = 0 dict_pos = {} for line in inf: var = line.strip().split("\t") dict_pos[var[2]] = "Y" inf.close() counter = 0 results = Variant.find_by(q="chr6:26491708-26530420") for r in results: counter += 1 try: begin = r.dbsnp['hg19']['start'] found_snp = dict_pos[str(begin)] rsID = r.dbsnp["rsid"] print rsid except: print "shit" continue print "Counter " + str(counter) inf.close() outf.close()