Entering edit mode
10.1 years ago
jon.brate
▴
310
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"))