Ncbixml.Parse doesn't process all the results
Greetings, I am trying to parse by Blast results using "NCBIXML.parse", however when i run it it only analysis few results and not the whole file. If anybody knows the solution to it I would really appreciate it.
from Bio.Blast import NCBIXML
E_VALUE_THRESH = 1
with open("Coilia_nasus_results.xml","r") as result:
records= NCBIXML.parse(result)
item=next(records)
for alignment in item.alignments:
for hsp in alignment.hsps:
if hsp.expect < E_VALUE_THRESH:
print('****Alignment****')
print('sequence:', item.query)
print('length:', alignment.length)
print("e value:", hsp.expect)
print('score:', hsp.score)
print('gaps:', hsp.gaps)
print(hsp.sbjct)
• 839 views
•
link
1 answer
Was able to resolve this issue on my own!
from Bio.Blast import NCBIXML
E_VALUE_THRESH = 1
with open("Coilia_nasus_results.xml","r") as result:
blast_records = NCBIXML.parse(result)
for blast_record in blast_records:
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
if hsp.expect < E_VALUE_THRESH:
print('****Alignment****')
print('sequence:', blast_record.query)
print('length:', alignment.length)
print("e value:", hsp.expect)
print('score:', hsp.score)
print('gaps:', hsp.gaps)
print(hsp.sbjct)
• 0 views
•
link
Log in to answer this question.