Beispiel #1
0
def clustal_to_phylip(src,dest=None):
    import os
    from Bio.AlignIO.ClustalIO import ClustalIterator
    from Bio.AlignIO.PhylipIO import PhylipWriter
    if dest==None:
        dest = src
    head,tail = os.path.split(dest)
    _dest = os.path.join(head,"."+tail)
    with open(src) as i:
        alignments = list(ClustalIterator(i))
    with open(_dest,"w") as f:
        writer = PhylipWriter(f)
        writer.write_file(alignments)
    os.rename(_dest,dest)
    return dest