This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how can i use python to align dna sequences with t-coffee algorithm??

Hi i am a python beginner

i want to use python to align alot of sequences with t-coffee algorithm

what environment should i have?i mean i should install python and what else?

sample dataset

>X05053.1-3_118
CCTGGCGGCCATGGCGAACCGGAACCACCCGATCCCATCTCGAACTCGGAAGTGAAACGG
TTCAGCGCCGATGA-TAGTGTG--GGGCCTCCCCATGTGAAAGTAGGTCACTGCCAGGC
>M36159.1-2_116
-CAGGTGGTGATGGCGGAAAGGTCACACCCGAACACATCCCGAACTCGGAAGTTAAGCTT
TCCAGCGCCGATG-GTAGTTGG--GGGTTTCCCCCTGCGAGAGTAGGACGTTGCCGGGC
>Z50737.1-3_119
AACGGCGGTCATAGCGGTGGGGAAACGCCCGGTCCCATCCCGAACCCGGAAGCTAAGCCC
ACCAGCGCCGATG-GTACTGCACTC-GTGAGGGTGTGGGAGAGTAGGACGCCGCCGGAC
>X02631.1-2_115
GCTGGCGACCATAGCAAGAGTGAACCACCTGATCCCTTCCCGAACTCAGAAGTGAAACCT
CTTCGCGCTGATG-GTAGTGNGG-GT--TA-CCCATGTGAGAGTAAGTCATCGCCAGCT
>Z50057.1-2_118
GTCGGTGGTCATTGCGGAGGGGGAACGCCCGGTCCCATCCCGAACCCGGAAGCTAAGCCC
TCCAGCGCCGATG-GTACTGCACTC-GCCAGGGTGTGGGAGAGTAGGTCGCCGCCGACA

thanks in advance

sequencing alignment t-coffee python

You will have to install the T-Coffee project

But you don't need python to run this program. Eventualy you can use python to create the T-Coffee command line

I specially want to make a comparison between 3 algorithms (t-coffee , muscle , clustal) so I want to make apython code for every algorithm in this code I should call a lot of alignment

1 answer

Biopython provides a command line wrapper for T-Coffee. However it has a limited number of options.

You can install T-Coffee from the T-Coffee Project homepage as Bastien mentioned and run it directly. However if you wish to run T-Coffee commands within a python program you have developed, you can use the subprocess module of python to run the T-Coffee commands. After installing T-Coffee as per the installation guidelines, you can run your command as given below using Python 3.5 or higher.

import subprocess
subprocess.run(['t_coffee', 'sample.fasta'])

Note that sample.fasta contains your sample sequences.

The run() function will not capture the output of T-Coffee. If you want to capture the output of T-Coffee you can pass the subprocess.PIPE flag to the stdout argument of the run() function and then access the stdout attribute of the returned object.

output = subprocess.run(['t_coffee', 'sample.fasta'], stdout=subprocess.PIPE)
print(output.stdout)

Hope this helps. :)

thanks alot I specially want to make a comparison between 3 algorithms (t-coffee , muscle , clustal) so I want to make apython code for every algorithm.in this code I should call a lot of alignment

I hope you help me

You will have to write python scripts and call the subprocess module to run each .

Log in to answer this question.