This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to write relaxed AND sequential Phylip format using AlignIO?

Hi,

I want to convert alignments in fasta-format to phylip format, and I need to use phylip relaxed unless my taxon-names would be identical. I would also prefer to have non-interleaved phylip format, but "phylip-sequential" shortens the names.

Here's my code:

from Bio import SeqIO
from Bio import AlignIO
from Bio.Alphabet import IUPAC, Gapped

alignment = AlignIO.read(open("test.fas"), "fasta", alphabet=Gapped(IUPAC.protein))
g = open("test.phy", "w")
g.write (alignment.format("phylip-relaxed"))
alignment phylip alignio

1 answer

You can use this tool http://bit.ly/1utdbFg to convert FASTA format to a relaxed PHYLIP format :)

Log in to answer this question.