[Biopython] Maintaining partition order in concatenated nexus

Michael Gruenstaeudl mi.gruenstaeudl at gmail.com
Tue Jun 9 13:37:44 UTC 2015


Hi all,
like many others, I have been using the excellent example on the Biopython
wiki to concatenate multiple alignments into one nexus-file using
Biopython's Nexus.combine() function. However, what if I wish to maintain
the order of the nexus-partitions specified in 'file_list'. While the tuple
'nexi' is still ordered according to 'file_list',
'combined.charsets.items()' is not. Moreover, sorting the charsets is not
possible:

>>> combined.charsets.items()[0]
('partition0038_rps4_CDS.nex', [36567, 36568])

>>> combined.charsets.items()[1]
('partition0004_trnK_CDS.nex', [36569, 36573])

>>> for i in range(0,len(combined.charsets.items())):
...     combined.charsets.items()[i] = sorted_items[i]
...
>>> combined.charsets.items()[0]
('partition0038_rps4_CDS.nex', [36567, 36568])

What procedure would you recommend to maintain the input order of
'file_list' in the output file 'combined.nex'?

Thank you, Michael

--
Michael Gruenstaeudl (Grünstäudl), PhD
E-mail: mi.gruenstaeudl at gmail.com
Website: http://blogs.fu-berlin.de/gruenstaeudl/
<http://u.osu.edu/gruenstaeudl/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20150609/3957085c/attachment.html>


More information about the Biopython mailing list