BioPython,如何将.fasta转换为.aln进行clustal对齐?

tan*_*tan 2 python bioinformatics fasta biopython clustal

我有一个.fasta文件,我想转换为.aln,以便它可以与alignIO.read命令对齐或以某种方式给我的fasta文件"Clustal Headers",因为当我使用fasta文件时它只是输出它不是一个已知的clustal标题,是"ClustalwCommandline"返回应该这样做,因为在教程中它说它返回cline,只是打印cline,不知道如何处理cline

编辑: - 我也应该输出.dnd文件,不知道如何

Sha*_*mun 5

您无需手动转换任何内容,例如,如果您按照以下代码操作:

>>> from Bio.Align.Applications import ClustalwCommandline
Run Code Online (Sandbox Code Playgroud)

导入后ClustalwCommandline,您可以指定对齐文件的名称,cline是在下面的行中构造的命令:

>>> cline = ClustalwCommandline("clustalw", infile="opuntia1.fasta", outfile="opuntia1.aln")
>>> print cline
clustalw -infile=opuntia1.fasta -outfile=opuntia1.aln
Run Code Online (Sandbox Code Playgroud)

现在,当你正在编写以下行,c行()将运行在上面构建并返回输出和错误消息的命令stdout和stderrrespectivily变量.如果打印stdout和stderr,你会发现,标准输出印刷取向有关的东西和有对上述命令中没有错误,stderr说明不了什么,如果你打印.同时,在名为opuntia1.alnfile 的输出文件中包含了对齐.去打开那个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
Run Code Online (Sandbox Code Playgroud)

对于.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

希望有所帮助,干杯!