Hi All,
I am fairly new to python, and am trying to construct a phylogenetic tree through the following steps listed below. I have described my goals and the issue I am running into, if anyone could offer any advice it would be much appreciated, thank you!
GOALS
- Create a multiple sequence alignment file (MSA file) in phylip format using Biopython to call on Clustal Omega
- Use PhyML Biopython module to create a maxiumum likelihood phylogenetic tree inference using the phylip MSA file in step 1 (PhyML only takes phylip format). This will output a new file in newick format
- Parse this newick file using the Phylo module in Biopython and create and manipulate the tree using matplotlib.
PROBLEM
I cannot get step 1, the Clustal Omega portion described above, to output a MSA file in phylip format. According to the module outline, described here: https://biopython.org/DIST/docs/api/Bio.Align.Applications._ClustalOmega-pysrc.html#ClustalOmegaCommandline.__init__ , describing outfmt as phylip should be sufficient. However, when I run in commandline, I am given the following error:
clustalomega_cline = ClustalOmegaCommandline(infile = in_file, outfile = out_file, outfmt = phylip, verbose = True, auto = False)
NameError: name 'phylip' is not defined
Here is my code:
from Bio.Align.Applications import ClustalOmegaCommandline
define input file
in_file = "in_filename.fasta"
# define output file (I have tried just adding .phylip or no .format)
out_file = "out_filename.phylip"
# get the command for Clustal Omega
# what I tried and what should work: outfmt = phylip
clustalomega_cline = ClustalOmegaCommandline(infile = in_file, outfile = out_file, verbose = True, auto = False)
# print the executable command
print(clustalomega_cline)
# The commandline will prompt you at this point to enter the line calling to your file, it should have this format:
# ./clustal-omega-1.2.3-macosx -i in_filename.fasta -o in_filename.phylip --auto -v
Please let me know if you have any insight into this issue, and thank you so much!
thank you @Carambakaracho !