[Biopython-dev] PATCH: NumPy support for BioPython

Ed Schofield edschofield at gmail.com
Fri Mar 9 18:35:51 UTC 2007


On 3/5/07, Ed Schofield <edschofield at gmail.com> wrote:
>
>
> I've started work on a simple wrapper layer for Biopython to use either
> Numeric or numpy.oldnumeric. I'll post more details soon.
>


I've now finished the first version of a patch to add support for NumPy in
addition to Numeric. I'll try to attach it to this message; you can also get
it from http://edschofield.com/biopython-numpy-support.patch. It applies
cleanly to the current CVS version using:

patch -p0 < biopython-numpy-support.patch

in the root biopython/ directory.

The main difficulty I had to overcome was with C extensions, particularly
the Cluster module. This is because NumPy defines array dimensions and
strides as intp types, whereas Numeric defines them as int, which differs on
64-bit platforms.

Some tests fail; these failures all result from overly fragile expectations
on the formatting of the output. The tests should be updated, but I haven't
done this with this patch. All other tests pass with both NumPy and Numeric
on my machine.

MarkovModel.py had a bug in its setting of p_initial, p_transition, and
p_emission; it made an incorrect assumption about the behaviour of the
Python logical "or" operation when applied to Numeric arrays, which is
somewhat broken. I've tried to fix it, but someone familiar with
MarkovModel.py should look over the relevant lines (176-184) to be sure I
haven't changed the intended behaviour.

I'd like to continue contributing to BioPython. Whom should I contact about
CVS write access?

-- Ed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: biopython-numpy-support.patch
Type: text/x-patch
Size: 48870 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython-dev/attachments/20070309/50658af8/attachment-0002.bin>


More information about the Biopython-dev mailing list