[Biopython] convert to interleaved nexus

natassa natassa_g_2000 at yahoo.com
Tue Mar 26 01:25:43 UTC 2013


Hi, 

I am trying to convert a phylip alignment to interleaved nexus and I cannot. Something like:
def Convert_alnformat(alnfile, out, informat, outformat):
    alignment=AlignIO.read(alnfile, informat,  alphabet=Gapped(IUPAC.unambiguous_dna)) 
    SeqIO.write(alignment,out, outformat)

will give me a sequential nexus, while I can;'t seem to get hold of the write_nexus_data method of the Bio:Nexus:Nexus:Nexus class. 

As this is called internally by AlignIO or SeqIO , I am unsure of how to even call it within my function. I tried:
from Bio.Nexus import Nexus 

then in the function 

 Nexus.Nexus.write_nexus_data( alignment,interleave=True) 

and I get 

TypeError: unbound method write_nexus_data() must be called with Nexus instance as first argument (got MultipleSeqAlignment instance instead)

I understand that the alignment object is not a nexus instance, but I don't see what i should do.

Can you please help?
thanks, 

Natassa



More information about the Biopython mailing list