たとえば、次のコードに従う場合、手動で変換する必要はありません。
>>> from Bio.Align.Applications import ClustalwCommandline
をインポートした後ClustalwCommandline
、配置ファイルの名前を指定できます。これは、cline
以下の行で構築されているコマンドです。
>>> cline = ClustalwCommandline("clustalw", infile="opuntia1.fasta", outfile="opuntia1.aln")
>>> print cline
clustalw -infile=opuntia1.fasta -outfile=opuntia1.aln
ここで、次の行を書いているとき、cline() は上記で構成されたコマンドを実行し、出力とエラー メッセージをそれぞれ変数stdout
とstderr
変数に返します。と を印刷するstdout
とstderr
、stdout がアライメント関連のものを印刷していることがわかります。上記のコマンドにはエラーがなかったため、stderr
それを印刷しても何も表示されません。一方、 file と呼ばれる出力ファイルopuntia1.aln
には、現在の配置が含まれています。そのalnファイルに移動して開きます。アライメントが表示されるはずです。
>>> stdout, stderr = cline()
>>>
>>> print stdout
CLUSTAL 2.1 Multiple Sequence Alignments
Sequence format is Pearson
Sequence 1: CDS 1574 bp
Sequence 2: EST 723 bp
Start of Pairwise alignments
Aligning...
Sequences (1:2) Aligned. Score: 9
Guide tree file created: [opuntia1.dnd]
There are 1 groups
Start of Multiple Alignment
Aligning...
Group 1: Delayed
Alignment Score 490
CLUSTAL-Alignment file created [opuntia1.aln]
>>> print stderr
.dnd ファイルの場合、outfile を指定する必要はありません。コードを実行した後の既定のファイルは、fasta ファイルから dnd ファイルを作成します。ここに直接の引用があります:
By default ClustalW will generate an alignment and guide tree file with names based on the input FASTA file, in this case opuntia.aln and opuntia.dnd, but you can override this or make it explicit
ソース: http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec89
お役に立てば幸いです、乾杯!