如何用许多XML BLAST输出粘贴到一个文件中,一个python,解析XML文件
如何用许多XML BLAST输出粘贴到一个文件中,将XML文件解析为一个python。 我将每个爆炸输出粘贴到一个XML文件中。 它们被分开:
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN"
"http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd">
每个爆炸输出都以一个根开始:
<BlastOutput>
我的代码仅解析第一个爆炸结果:
with open(xml, 'r') as out_handle:
blast_records = NCBIXML.parse(out_handle)
blast_record = next(blast_records)
eval_tresh = 0.04
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
if hsp.expect < eval_tresh:
print('***Alignment***')
print('Sequence:', alignment.title)
# print('Length:', alignment.length)
# print('E value:', hsp.expect)
有人知道我如何与Bio.python一起逐一解析这些爆炸结果吗?
How to parse xml file with many xml BLAST outputs pasted into one file one by one Python.
I pasted each blast output into one xml file.
They are seperated with:
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN"
"http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd">
And each blast output starts with a root:
<BlastOutput>
My code that parse only the first blast result:
with open(xml, 'r') as out_handle:
blast_records = NCBIXML.parse(out_handle)
blast_record = next(blast_records)
eval_tresh = 0.04
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
if hsp.expect < eval_tresh:
print('***Alignment***')
print('Sequence:', alignment.title)
# print('Length:', alignment.length)
# print('E value:', hsp.expect)
Does anyone know how I could parse those blast results one by one with bio.python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论