[Biopython] How to run PAL2NAL commandline via python

Edson Ishengoma ishengomae at nm-aist.ac.tz
Fri Jan 17 07:11:41 UTC 2014


Dear all,

I recently was introduced to pal2nal as a convenient tool to convert
aligned protein residues (from tblastn, for example) back to their original
nucleotide sequences. My boss suggested I use a python or perl script to
call the tool and feed the resulting nucleotide alignments to the 'codeml'
program to calculate Ka, Ks.

I don't know perl, so I would like to know how to do this from python -- a
python script which includes the way to feed the resulting codon alignments
to  PAML for "codeml" program to calculate Ka, Ks values.

I tried to check for the pre-existence of  Biopython wrapper for Pal2Nal I
didnt see one. I am on linux machine (Ubuntu 13.04) and my installed python
is Python 2.7.4.
I tried this script which I expected to produce a file containing aligned
nucleotide sequences. But no error message is shown but it outputs an empty
file (nothing written on the file).

import os
> my_pal2nal = os.path.join(os.getcwd(), 'pal2nal.v14')
> my_prot_file = os.path.join(os.getcwd(), 'pal2nal.v14', 'dnds.aln')
> my_nucl_file = os.path.join(os.getcwd(), 'pal2nal.v14', 'dnds.nuc')
> output_file = '/home/edson/pal2nal.v14/output'
> os.system(my_pal2nal + 'perl pal2nal.pl' + my_prot_file + my_nucl_file +
> ' -output paml' + '>' + output_file + ' -nogap')
>

What perfect way should I proceed and how do I include a script for
'codeml'?

Thanks.

Regards,

Edson.



Edson B. Ishengoma
PhD-Candidate
*School of Life Sciences and Engineering
Nelson Mandela African Institute of Science and Technology
Nelson Mandela Road
P. O. Box 447, Arusha
Tanzania (255)
*
*ishengomae at nm-aist.ac.tz  *ebarongo82 at yahoo.co.uk
*

<http://www.nm-aist.ac.tz/>Mobile: +255 762 348 037, +255 714 789 360,
  Website: www.nm-aist.ac.tz
Skype: edson.ishengoma

*
*
**



More information about the Biopython mailing list