Created
March 18, 2014 07:12
-
-
Save mscook/9614992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Bio.Blast import NCBIXML | |
input = 'CFT073.B2_comp.fa_blast.xml' | |
for record in NCBIXML.parse(open('CFT073.B2_comp.fa_blast.xml')): | |
for align in record.alignments: | |
for idx, hsp in enumerate(align.hsps): | |
if idx == 0: | |
print ">"+input.split("_")[0]+"_"+record.query.split(',')[1].strip() | |
print hsp.sbjct | |
else: | |
print ">Multiple HSP's for"+record.query.split(',')[1].strip()+str(hsp.sbjct_start)+":"+str(hsp.sbjct_end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment