T Coffee Commandline in Biopython
1
2
Entering edit mode
8.5 years ago

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 • 2.3k views
ADD COMMENT
1
Entering edit mode
8.5 years ago
Felix_Sim ▴ 260

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 COMMENT

Login before adding your answer.

Traffic: 2344 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6