def testSplitChrLoc(self): """ Tests spliting the chr_loc from chr1:1-100 to 1, 1, 100 Returns strings, not integers """ result01 = ann.split_chr_loc('chr1:1-100 ') result02 = ann.split_chr_loc('1:1-100') self.assertEquals(result01, ('1', '1', '100')) self.assertEquals(result02, ('1', '1', '100'))
def testSplitChrLoc(self): """ Tests spliting the chr_loc from chr1:1-100 to 1, 1, 100 Returns strings, not integers """ result01=split_chr_loc('chr1:1-100') result02=split_chr_loc('1:1-100') self.assertEquals(result01, ('1','1','100')) self.assertEquals(result02, ('1','1','100'))
def get_info(fname): """ Function to get information from csv file and create dictionary to write output file """ reader = csv.DictReader(fname, delimiter='\t') for d in reader: d.update() try: d['chromosome'], d['start'], d['end']=split_chr_loc(d['chr_loc']) except KeyError: print 'Key not found', fname continue yield d
def get_info(fname): """ Function to get information from csv file and create dictionary to write output file """ reader = csv.DictReader(fname, delimiter='\t') for d in reader: d.update() try: d['chromosome'], d['start'], d['end'] = split_chr_loc(d['chr_loc']) except KeyError: print 'Key not found', fname continue yield d