[Biopython-dev] PATCH: NumPy support for BioPython

Ed Schofield edschofield at gmail.com
Wed Mar 21 08:55:34 EDT 2007


On 3/20/07, Michiel Jan Laurens de Hoon <mdehoon at c2b2.columbia.edu> wrote:
> Sebastian Bassi wrote:
> > On 3/14/07, Michiel Jan Laurens de Hoon <mdehoon at c2b2.columbia.edu> wrote:
> >> OK, thanks. I have fixed clustermodule.c in Biopython's CVS to use
> >> PyArray_ISCONTIGUOUS instead of (flags & CONTIGUOUS).
> >> I'll look at this patch in more detail after the upcoming release is out.
> >
> > Did the numpy instead of numeric made it into 1.43?
> >
> Yes and no.
>
> Yes):
>
> The patch above did make it in, which means that it is now fairly easy
> to compile Biopython with Numpy instead of Numeric. All you would have
> to do is to change the #include <Numeric/arrayobject.h> statements in
> the C-code to #include <whereever/numpy/puts/its/arrayobject.h>


A more honest answer would have been "no". To compile and _actually
use_ NumPy one needs somewhat more than to "probably ... tinker with
the Python code". At a minimum one must change the Python import
statements, change references to obsoleted function names, fix the
broken array boolean operators in MarkovModel.py, and, for 64-bit
platforms, fix the width of the dimension data types in cluster.c.
These changes are not optional. To make it buildable one also needs to
change the distutils setup.py file to get the new header locations.
And if one ever needs to install Numeric after installing BioPython,
one wants a mechanism to avoid segfaults when importing incompatible
compiled C modules.

In short, one still needs my patch.

-- Ed


More information about the Biopython-dev mailing list