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

Hi!

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")
print(cline)

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.1k views
ADD COMMENTlink modified 3.4 years ago by Felix_Sim240 • written 3.4 years ago by the_madinator20
1
gravatar for Felix_Sim
3.4 years ago by
Felix_Sim240
United Kingdom
Felix_Sim240 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",
                                       output="clustalw",
                                       outfile="aligned.aln")
>>> 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 3.4 years ago by Felix_Sim240
Please log in to add an answer.

Help
Access

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