2

我有一个 .fasta 文件,我希望将其转换为 .aln 以便它可以与 alignIO.read 命令对齐,或者以某种方式给我的 fasta 文件“Clustal Headers”,因为当我使用 fasta 文件时它只是输出它不是一个已知的 clustal 标头,是应该执行此操作的“ClustalwCommandline”返回,因为在教程中它说将其返回分配给 cline,并且只打印 cline,不确定如何处理 cline

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

4

1 回答 1

6

您无需手动转换任何内容,例如,如果您遵循以下代码:

>>> 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() 运行上面构建的命令,并将输出和错误消息分别返回到变量stdoutstderr变量。如果您打印stdoutand stderr,您会发现 stdout 正在打印与对齐相关的内容,并且由于上述命令没有错误,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

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

希望有帮助,干杯!

于 2014-05-27T06:41:52.360 回答