biopython/biopython — pull request #33 by lennax (2012-04-19 22:35:03+00:00)
Title: Feature: Python implementation of MMCIF parser

I've written a PLY (Python lex-yacc) module that is superimposable with the C MMCIF module.

I've also partially rewritten the C MMCIF module to be object-oriented.

### Changed files ###

* MMCIFlexmodule.c: Now object-oriented (open file in constructor, close file in destructor, etc). Docstrings! Added file IO exception.
* MMCIF2Dict.py: Minor changes for new object oriented API
* MMCIFParser: Changed all uses of map() to list comprehensions (more compatible with 3)

### New files ###

* MMCIFlex.py: PLY-based module for tokenizing input.

### What it needs ###
Addition of PLY dependency to setup.py.
I'm not quite sure how to handle this, as PLY wouldn't be necessary on a platform with C Python. Thoughts? Which non-CPython implementations are worth testing?

New C module tested on Python 2.6 on Mac OS X and Debian. I hope it still works on Windows.
On my machine, the C module processes a 30,000 line test file in 10-15 ms; the Python module takes ~150 ms.