:
http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc90
は、あなたがSeqIOオブジェクトをサポートしていないことbiopythonのBLASTで正しいように思われますまたは生物学的配列をBLAST関数呼び出しのパラメータとして使用するか、またはBLASTバイナリのsubprocess.call()
を使用して実行します。受け入れられる入力シーケンスパラメータは、ファイル名だけです。チュートリアル:
>>> from Bio.Blast.Applications import NcbiblastxCommandline
>>> help(NcbiblastxCommandline)
...
>>> blastx_cline = NcbiblastxCommandline(query="opuntia.fasta", db="nr", evalue=0.001,
... outfmt=5, out="opuntia.xml")
>>> blastx_cline
NcbiblastxCommandline(cmd='blastx', out='opuntia.xml', outfmt=5, query='opuntia.fasta',
db='nr', evalue=0.001)
>>> print(blastx_cline)
blastx -out opuntia.xml -outfmt 5 -query opuntia.fasta -db nr -evalue 0.001
>>> stdout, stderr = blastx_cline()
したがって、唯一のオプションは、実際のFASTAファイルを入力として使用することです。一度に1つのシーケンスを照会する場合は、各シーケンスをファイルに保存する必要があります。しかし、あなたがそうする理由がない限り、私はこれに対して推奨します。 BLAST は、すべてのクエリシーケンスが同じファイル内にある場合、より高速に実行できると思います。また、あなたはBioPythonは、各クエリの結果を反復するために使用したBLAST出力を読み取ることができ、以下を参照してください上記のリンクから撮影
http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc92
例:代わりに、あなたには、いくつかの他の方法BLASTを実行した場合は
、そしてあなたがする必要があるすべては読書のためのファイルを開くことで、ファイルmy_blast.xmlに(XML形式)BLAST出力を持っている:あなたは結果の多く(すなわち、複数のクエリを持っている場合
>>> result_handle = open("my_blast.xml")
>>> from Bio.Blast import NCBIXML
>>> blast_record = NCBIXML.read(result_handle)
または、シーケンス):
>>> from Bio.Blast import NCBIXML
>>> blast_records = NCBIXML.parse(result_handle)
だけBio.SeqIOとBio.AlignIOのように(章5および6を参照)、我々は、入力機能のペアを持って、読んで、リードは、あなたが正確に一つのオブジェクトを持っているときのためであり、解析し、解析は、 SeqRecordまたはMultipleSeqAlignmentオブジェクトを取得する代わりに、BLASTレコードオブジェクトを取得します。
何千もの結果を含むBLASTファイルが巨大な状況に対処できるように、NCBIXML.parse()はイテレータを返します。
>>> from Bio.Blast import NCBIXML
>>> blast_records = NCBIXML.parse(result_handle)
>>> blast_record = next(blast_records)
# ... do something with blast_record
>>> blast_record = next(blast_records)
# ... do something with blast_record
>>> blast_record = next(blast_records)
# ... do something with blast_record
>>> blast_record = next(blast_records)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
# No further records