[Biopython-dev] PATCH: NumPy support for BioPython

Michiel Jan Laurens de Hoon mdehoon at c2b2.columbia.edu
Tue Mar 20 20:46:52 UTC 2007


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>. (Why 
the Numpy folks put arrayobject.h in a different location, I don't know; 
if they hadn't, a transition to Numpy would have been a lot easier).

But, if you're not on a 32-bits platform, Bio.Cluster will not work 
correctly. Also, some import statements will fail (e.g. from Numeric 
import * should become from numpy import *).

So, in summary, you can compile the code but you'll probably have to 
tinker with the Python code. On the bright side, most of Biopython does 
not need Numeric or Numpy, so 90% of Biopython will work.

No):

Adding numpy support is a major undertaking; it's not something I'd want 
to add one week before a release is coming out. Some tests fail with 
Numpy. While these don't seem to be major issues, it's something that 
needs to be fixed first. An additional problem is that we cannot just 
drop Numeric support, so we'll have to support both for now. Numeric is 
still needed because (a) Numpy does not compile cleanly on all major 
platforms (for example on Cygwin); (b) Other Python software relevant to 
computational biology uses Numeric; (c) Numpy's documentation costs $40; 
Numeric's free.

--Michiel.


-- 
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1130 St Nicholas Avenue
New York, NY 10032



More information about the Biopython-dev mailing list