Mercurial > repos > yating-l > jbrowse_hub
diff blastxmlToGff3.py @ 48:6803152ea92a draft
planemo upload for repository https://github.com/Yating-L/jbrowse_hub commit 073c8ceda5eddfb4ccd07cfa96a8353e5535ffaf-dirty
author | yating-l |
---|---|
date | Tue, 28 Mar 2017 18:13:27 -0400 |
parents | 15b4a74722d1 |
children |
line wrap: on
line diff
--- a/blastxmlToGff3.py Wed Mar 22 15:20:56 2017 -0400 +++ b/blastxmlToGff3.py Tue Mar 28 18:13:27 2017 -0400 @@ -137,12 +137,18 @@ group['parent_field']['end'] = coords[1] group['parent_field']['score'] = group['parent_field']['strand'] = group['parent_field']['phase'] = '.' group['parent_attribute']['match_num'] = match_num + group['alignments'].sort(key=lambda x: (x['field']['start'], x['field']['end'])) utils.write_features(group['parent_field'], group['parent_attribute'], gff3) + prev_end = -1 for align in group['alignments']: + overlap = '' + if align['field']['start'] <= prev_end: + overlap += str(align['field']['start']) + ',' + str(prev_end) + prev_end = align['field']['end'] + align['attribute']['overlap'] = overlap utils.write_features(align['field'], align['attribute'], gff3) gff3.close() - def blastxml2gff3(xml_file, gff3_file): result_handle = open(xml_file) blast_records = NCBIXML.parse(result_handle)