[Biopython-dev] Nexus parser

Jonathan Taylor jonathan.taylor at utoronto.ca
Tue Feb 15 17:30:11 EST 2005


My view is that we should not change the dependency to python 2.4 yet. 
I think adding a conditional install is acceptable though and its 
awesome to have since I have had to do some of this nexus parsing by 
hand in the past.

Cheers.
Jon.

Iddo Friedberg wrote:
> Hi all,
> 
> Good News: Frank Kauff & Cymon Cox has contributed a Nexus parser to 
> Biopython, for our next release. It's a mighty useful and nifty package 
> if you are into trees (the phylogenetic ones, not the ones in the 
> forest). He put a lot of effort into this to get this ready for 
> Biopython 1.40
> 
> Bad news: it's for Python 2.4. Please read on and I'd like to have your 
> opinion on whether we should include this in the upcoming release. 
> Python 2.4 stable has only been released less that 3 months ago, and 
> many of our users may not have upgraded yet. Heck, I haven't (but I 
> can). All current Linux distros use a <=2.3 version, and 2.3 does not 
> have Sets. One thing we could do is put a Python version check in the 
> setup.py file, and not include Nexus in the build if Python is not 
>  >=2.4. However, the RPM builders should probably do without it.
> 
> Anyhow, please let me have your opinions about this.
> 
> Thanks, all. And thanks Frank & Cymon for your contribution.
> 
> Iddo
> 
>> Hi Iddo,
>>
>> here's the baby (please note that this is the result of a cooperation
>> with Cymon J. Cox) 
>> Nexus.py - the actual nexus parser,
>> Trees.py - the module for reading and manipulating phylogenetic trees
>> (used by Nexus.py)
>> Nodes.py - provides a linked list which is the backbone of tree storage
>> in Trees.py (but might be useful for other purposes as well)
>> cnexus.c -  a c extension that does the first round of parsing through a
>> nexus input file. Nexus.py works without cnexus.c, but is awfully slow
>> with larger files (and Nexus files can be large).
>>
>> Assuming that it will live in Bio.Nexus, the import statements might
>> need some adjustments.
>>
>> I also added test routines test_Nexus.py, the corresponding input file
>> in Nexus/test_Nexus_input.nex and the correct output in
>> output/text_Nexus.
>>
>> It just appears to me that it needs Python 2.4, because it uses sets,
>> and it uses them in 2.4 syntax. Is this a problem? Is the next release
>> of biopython still distributed for 2.2?
>>  
>>
>> Nexus files come in lots of different flavors, and people use them for
>> very different purposes. I expect a lot of bug reports (guess in
>> contrast to the Ace and Phd parser we submitted earlier people might
>> actually use it :-) ) - many of them probably due to the fact that a lot
>> of programs writes "Nexus-like" output files completely ignoring the
>> quasi-official Nexus standard from Maddison/Swofford/Maddison... As I
>> don't have cvs access, I guess I'll send bugfixes to you?
>>
>> I'll do my best and write some cookbook introduction later this month.
>> The parser has accumulated quite a few functions over time (esp.
>> Trees.py), some of them might benefit from a few words of explanation.
>> However, the basic functionality like
>>  
>>
>>>> n=Nexus('input_file.nex')
>>>> print n.nchar, n.ntax, n.charpartitions
>>>>     
>>
>>
>> is pretty straightforward.
>>
>>
>> Hope all this makes some sense, let me know if you need some more info.
>> Thanks for all your work with the new release!
>>
>> All the best,
>> Frank
>>
>>
>>  
>>




More information about the Biopython-dev mailing list