假设您有从以下位置获得的 XML qblast()
:
from Bio.Blast import NCBIXML
xml = NCBIXML.parse(your_xml_handler)
for blast in xml:
for hit in blast.alignments:
# Each hit is a Blast.Record.Alignment
# http://biopython.org/DIST/docs/api/Bio.Blast.Record.Alignment-class.html
# Here you can obtain the hit id
# Something like "gi|588481781|gb|KF958277.1|"
id = hit.hit_id
for hsp in hit.hsps:
# Here you have access to each HSP
# http://biopython.org/DIST/docs/api/Bio.Blast.Record.HSP-class.html
start = hsp.sbjct_start
end = hsp.sbjct_end
有了id、start和end就可以查询数据库获取基因信息。这就是它在 WebBlast 中的完成方式(可能),但它们为“功能”提供了快捷方式。