Question: T Coffee Commandline in Biopython
gravatar for the_madinator
4.2 years ago by
the_madinator20 wrote:


I am attempting to use the T Coffee Commandline in Biopython to compare two multiple sequence alignments, but I am having some problems. Currently, I have:

from Bio.Align.Applications import TCoffeeCommandline
cline = TCoffeeCommandline("aln_compare",
            al1 = "Alignment1.clustalw_aln",
            al2 = "Alignment2.clustalw_aln",
            outfile = "aln_compare.txt")

From the T Coffee manual the command line I am attempting to use is:

t_coffee -other_pg aln_compare -al1 b30.aln -al2 p350.aln

However, when I run it I get: raise ValueError("Option name %s was not found." % name), ValueError: Option name al2 was not found.

Also, is there a better way to do this, other than using the command line wrapper?

I am very new to this, so any help would be greatly appreciated.

alignment python commandline • 1.3k views
ADD COMMENTlink modified 4.2 years ago by Felix_Sim250 • written 4.2 years ago by the_madinator20
gravatar for Felix_Sim
4.2 years ago by
United Kingdom
Felix_Sim250 wrote:

Currently, the TCoffeeCommandline wrapper does not support the comparison of sequence alignments. According to the source code and documentation, it can only align sequences from a single sequence file. I.e., if you have 10 sequences in unaligned.fasta, you can align those sequences using the wrapper with the following code:

>>> from Bio.Align.Applications import TCoffeeCommandline
>>> tcoffee_cline = TCoffeeCommandline(infile="unaligned.fasta",
>>> print(tcoffee_cline)
t_coffee -output clustalw -infile unaligned.fasta -outfile aligned.aln

However, you can construct the command line relatively easily yourself. Consider the following:

def construct_cmd_tcoffee(method, al1, al2):
    return "t_coffee -other_pg {method} -al1 {al1} -al2 {al2}".format(method=method, 
                                                                      al1=al1, al2=al2)

cline = construct_cmd_tcoffee("aln_compare", "Alignment1.clustalw_aln", "Alignment2.clustalw_aln")

Having the construction in a function allows you to re-use it without re-writing the assembly itself again.

ADD COMMENTlink written 4.2 years ago by Felix_Sim250
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 755 users visited in the last hour