James Taylor avatar James Taylor committed 3115f44

Adding generated C code for array_tree.pyx

Comments (0)

Files changed (2)

lib/bx/arrays/array_tree.c

+/* Generated by Cython 0.11.1 on Thu May 14 17:22:27 2009 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#include "structmember.h"
+#ifndef Py_PYTHON_H
+    #error Python headers needed to compile C extensions, please install development version of Python.
+#endif
+#ifndef PY_LONG_LONG
+  #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef DL_EXPORT
+  #define DL_EXPORT(t) t
+#endif
+#if PY_VERSION_HEX < 0x02040000
+  #define METH_COEXIST 0
+  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  typedef int Py_ssize_t;
+  #define PY_SSIZE_T_MAX INT_MAX
+  #define PY_SSIZE_T_MIN INT_MIN
+  #define PY_FORMAT_SIZE_T ""
+  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
+  #define PyNumber_Index(o)    PyNumber_Int(o)
+  #define PyIndex_Check(o)     PyNumber_Check(o)
+#endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
+  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
+  #define PyVarObject_HEAD_INIT(type, size) \
+          PyObject_HEAD_INIT(type) size,
+  #define PyType_Modified(t)
+
+  typedef struct {
+       void *buf;
+       PyObject *obj;
+       Py_ssize_t len;
+       Py_ssize_t itemsize;
+       int readonly;
+       int ndim;
+       char *format;
+       Py_ssize_t *shape;
+       Py_ssize_t *strides;
+       Py_ssize_t *suboffsets;
+       void *internal;
+  } Py_buffer;
+
+  #define PyBUF_SIMPLE 0
+  #define PyBUF_WRITABLE 0x0001
+  #define PyBUF_FORMAT 0x0004
+  #define PyBUF_ND 0x0008
+  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+#if PY_MAJOR_VERSION < 3
+  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define Py_TPFLAGS_CHECKTYPES 0
+  #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define PyBaseString_Type            PyUnicode_Type
+  #define PyString_Type                PyBytes_Type
+  #define PyString_CheckExact          PyBytes_CheckExact
+  #define PyInt_Type                   PyLong_Type
+  #define PyInt_Check(op)              PyLong_Check(op)
+  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
+  #define PyInt_FromString             PyLong_FromString
+  #define PyInt_FromUnicode            PyLong_FromUnicode
+  #define PyInt_FromLong               PyLong_FromLong
+  #define PyInt_FromSize_t             PyLong_FromSize_t
+  #define PyInt_FromSsize_t            PyLong_FromSsize_t
+  #define PyInt_AsLong                 PyLong_AsLong
+  #define PyInt_AS_LONG                PyLong_AS_LONG
+  #define PyInt_AsSsize_t              PyLong_AsSsize_t
+  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
+  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+  #define PyBytes_Type                 PyString_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+  #ifndef __stdcall
+    #define __stdcall
+  #endif
+  #ifndef __cdecl
+    #define __cdecl
+  #endif
+#else
+  #define _USE_MATH_DEFINES
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
+#else
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_NAMESTR(n) ((char *)(n))
+  #define __Pyx_DOCSTR(n)  ((char *)(n))
+#else
+  #define __Pyx_NAMESTR(n) (n)
+  #define __Pyx_DOCSTR(n)  (n)
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+#include <math.h>
+#define __PYX_HAVE_API__bx__arrays__array_tree
+#include "stdlib.h"
+#include "numpy/arrayobject.h"
+
+
+#ifdef __GNUC__
+#define INLINE __inline__
+#elif _WIN32
+#define INLINE __inline
+#else
+#define INLINE 
+#endif
+
+typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
+
+
+
+static int __pyx_skip_dispatch = 0;
+
+
+/* Type Conversion Predeclarations */
+
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyBytes_FromString          PyString_FromString
+#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
+#define __Pyx_PyBytes_AsString            PyString_AsString
+#else
+#define __Pyx_PyBytes_FromString          PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
+#define __Pyx_PyBytes_AsString            PyBytes_AsString
+#endif
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+
+#if !defined(T_PYSSIZET)
+#if PY_VERSION_HEX < 0x02050000
+#define T_PYSSIZET T_INT
+#elif !defined(T_LONGLONG)
+#define T_PYSSIZET \
+        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
+        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
+#else
+#define T_PYSSIZET \
+        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
+        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
+        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
+#endif
+#endif
+
+#if !defined(T_SIZET)
+#if !defined(T_ULONGLONG)
+#define T_SIZET \
+        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
+        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
+#else
+#define T_SIZET \
+        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
+        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
+        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
+#endif
+#endif
+
+static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+
+
+#ifdef __GNUC__
+/* Test for GCC > 2.95 */
+#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* __GNUC__ > 2 ... */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ > 2 ... */
+#else /* __GNUC__ */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ */
+    
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+static const char **__pyx_f;
+
+#ifdef CYTHON_REFNANNY
+typedef struct {
+  void (*INCREF)(void*, PyObject*, int);
+  void (*DECREF)(void*, PyObject*, int);
+  void (*GOTREF)(void*, PyObject*, int);
+  void (*GIVEREF)(void*, PyObject*, int);
+  void* (*NewContext)(const char*, int, const char*);
+  void (*FinishContext)(void**);
+} __Pyx_RefnannyAPIStruct;
+static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
+#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
+#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
+#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
+#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
+#else
+#define __Pyx_INCREF(r) Py_INCREF(r)
+#define __Pyx_DECREF(r) Py_DECREF(r)
+#define __Pyx_GOTREF(r)
+#define __Pyx_GIVEREF(r)
+#define __Pyx_XDECREF(r) Py_XDECREF(r)
+#define __Pyx_SetupRefcountContext(name)
+#define __Pyx_FinishRefcountContext()
+#endif /* CYTHON_REFNANNY */
+#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
+#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
+
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name, PyObject* kw_name); /*proto*/
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+
+#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
+                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
+
+static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
+    int r;
+    if (!j) return -1;
+    r = PyObject_SetItem(o, j, v);
+    Py_DECREF(j);
+    return r;
+}
+
+static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        Py_INCREF(v);
+        Py_DECREF(PyList_GET_ITEM(o, i));
+        PyList_SET_ITEM(o, i, v);
+        return 1;
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
+        return PySequence_SetItem(o, i, v);
+    else {
+        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
+        return __Pyx_SetItemInt_Generic(o, j, v);
+    }
+}
+
+
+static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+
+
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    PyObject *r;
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+        r = PySequence_GetItem(o, i);
+    }
+    else {
+        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+    }
+    return r;
+}
+
+static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+    const char *name, int exact); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+#include "descrobject.h"
+static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
+
+static INLINE long __Pyx_pow_long(long, long); /* proto */
+
+static INLINE int __Pyx_pow_int(int, int); /* proto */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
+
+static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+
+static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+
+static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+
+static INLINE char __Pyx_PyInt_AsChar(PyObject *);
+
+static INLINE short __Pyx_PyInt_AsShort(PyObject *);
+
+static INLINE int __Pyx_PyInt_AsInt(PyObject *);
+
+static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+
+static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+
+static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+
+static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
+
+static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
+
+static INLINE long __Pyx_PyInt_AsLong(PyObject *);
+
+static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
+
+static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
+
+static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size);  /*proto*/
+
+static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
+
+static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+/* Type declarations */
+
+typedef npy_int8 __pyx_t_5numpy_int8_t;
+
+typedef npy_int16 __pyx_t_5numpy_int16_t;
+
+typedef npy_int32 __pyx_t_5numpy_int32_t;
+
+typedef npy_int64 __pyx_t_5numpy_int64_t;
+
+typedef npy_uint8 __pyx_t_5numpy_uint8_t;
+
+typedef npy_uint16 __pyx_t_5numpy_uint16_t;
+
+typedef npy_uint32 __pyx_t_5numpy_uint32_t;
+
+typedef npy_uint64 __pyx_t_5numpy_uint64_t;
+
+typedef npy_float32 __pyx_t_5numpy_float32_t;
+
+typedef npy_float64 __pyx_t_5numpy_float64_t;
+
+typedef npy_long __pyx_t_5numpy_int_t;
+
+typedef npy_longlong __pyx_t_5numpy_long_t;
+
+typedef npy_ulong __pyx_t_5numpy_uint_t;
+
+typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
+
+typedef npy_double __pyx_t_5numpy_float_t;
+
+typedef npy_double __pyx_t_5numpy_double_t;
+
+typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+
+typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
+
+typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
+
+typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":69
+ *     cdef public object sumsquares
+ * 
+ * cdef class ArrayTreeNode             # <<<<<<<<<<<<<<
+ * cdef class ArrayTreeLeaf
+ * 
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_vtab;
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree;
+  int min;
+  int max;
+  int block_size;
+  int level;
+  int child_size;
+  PyObject *children;
+  struct __pyx_obj_2bx_6arrays_10array_tree_Summary *summary;
+  long start_offset;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":58
+ * VERSION = 0
+ * 
+ * cdef class Summary( object ):             # <<<<<<<<<<<<<<
+ *     """
+ *     Summary for a non-leaf level of the tree, contains arrays of the min, max,
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_Summary {
+  PyObject_HEAD
+  PyObject *counts;
+  PyObject *mins;
+  PyObject *maxs;
+  PyObject *sums;
+  PyObject *sumsquares;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":72
+ * cdef class ArrayTreeLeaf
+ * 
+ * cdef class ArrayTree:             # <<<<<<<<<<<<<<
+ *     """
+ *     Stores a sparse array of data as a tree.
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree {
+  PyObject_HEAD
+  int max;
+  int block_size;
+  PyObject *dtype;
+  int levels;
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *root;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":70
+ * 
+ * cdef class ArrayTreeNode
+ * cdef class ArrayTreeLeaf             # <<<<<<<<<<<<<<
+ * 
+ * cdef class ArrayTree:
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf {
+  PyObject_HEAD
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree;
+  int min;
+  int max;
+  PyArrayObject *values;
+  long start_offset;
+};
+
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":152
+ *         return tree
+ * 
+ * cdef class ArrayTreeNode:             # <<<<<<<<<<<<<<
+ *     """
+ *     Internal node of an ArrayTree. Contains summary data and pointers to
+ */
+
+struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode {
+  PyObject *(*init_bin)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int);
+  PyObject *(*build_summary)(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *, int __pyx_skip_dispatch);
+};
+static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_vtabptr_2bx_6arrays_10array_tree_ArrayTreeNode;
+/* Module declarations from python_buffer */
+
+/* Module declarations from stdlib */
+
+/* Module declarations from numpy */
+
+/* Module declarations from numpy */
+
+static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
+static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *); /*proto*/
+/* Module declarations from bx.arrays.array_tree */
+
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_Summary = 0;
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode = 0;
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf = 0;
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree = 0;
+static PyObject *__pyx_k_27 = 0;
+
+const char *__pyx_modulename = "bx.arrays.array_tree";
+
+/* Implementation of bx.arrays.array_tree */
+static PyObject *__pyx_int_0x310ec7dc;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1000;
+static PyObject *__pyx_int_neg_1;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_3;
+static PyObject *__pyx_int_2;
+static PyObject *__pyx_int_5;
+static char __pyx_k___init__[] = "__init__";
+static PyObject *__pyx_kp___init__;
+static char __pyx_k___setitem__[] = "__setitem__";
+static PyObject *__pyx_kp___setitem__;
+static char __pyx_k___getitem__[] = "__getitem__";
+static PyObject *__pyx_kp___getitem__;
+static char __pyx_k_to_file[] = "to_file";
+static PyObject *__pyx_kp_to_file;
+static char __pyx_k_from_file[] = "from_file";
+static PyObject *__pyx_kp_from_file;
+static char __pyx_k_from_sequence[] = "from_sequence";
+static PyObject *__pyx_kp_from_sequence;
+static char __pyx_k_set[] = "set";
+static PyObject *__pyx_kp_set;
+static char __pyx_k_get[] = "get";
+static PyObject *__pyx_kp_get;
+static char __pyx_k_build_summary[] = "build_summary";
+static PyObject *__pyx_kp_build_summary;
+static char __pyx_k_to_file_data_pass[] = "to_file_data_pass";
+static PyObject *__pyx_kp_to_file_data_pass;
+static char __pyx_k_to_file_offset_pass[] = "to_file_offset_pass";
+static PyObject *__pyx_kp_to_file_offset_pass;
+static char __pyx_k_value[] = "value";
+static PyObject *__pyx_kp_value;
+static char __pyx_k_max[] = "max";
+static PyObject *__pyx_kp_max;
+static char __pyx_k_block_size[] = "block_size";
+static PyObject *__pyx_kp_block_size;
+static char __pyx_k_dtype[] = "dtype";
+static PyObject *__pyx_kp_dtype;
+static char __pyx_k_index[] = "index";
+static PyObject *__pyx_kp_index;
+static char __pyx_k_f[] = "f";
+static PyObject *__pyx_kp_f;
+static char __pyx_k_s[] = "s";
+static PyObject *__pyx_kp_s;
+static char __pyx_k_tree[] = "tree";
+static PyObject *__pyx_kp_tree;
+static char __pyx_k_min[] = "min";
+static PyObject *__pyx_kp_min;
+static char __pyx_k_level[] = "level";
+static PyObject *__pyx_kp_level;
+static char __pyx_k_io[] = "io";
+static PyObject *__pyx_kp_io;
+static char __pyx_k_23[] = "ArrayTree";
+static PyObject *__pyx_kp_23;
+static char __pyx_k___all__[] = "__all__";
+static PyObject *__pyx_kp___all__;
+static char __pyx_k_numpy[] = "numpy";
+static PyObject *__pyx_kp_numpy;
+static char __pyx_k_24[] = "*";
+static PyObject *__pyx_kp_24;
+static char __pyx_k_25[] = "bx.misc.binary_file";
+static PyObject *__pyx_kp_25;
+static char __pyx_k_BinaryFileWriter[] = "BinaryFileWriter";
+static PyObject *__pyx_kp_BinaryFileWriter;
+static char __pyx_k_BinaryFileReader[] = "BinaryFileReader";
+static PyObject *__pyx_kp_BinaryFileReader;
+static char __pyx_k_MAGIC[] = "MAGIC";
+static PyObject *__pyx_kp_MAGIC;
+static char __pyx_k_VERSION[] = "VERSION";
+static PyObject *__pyx_kp_VERSION;
+static char __pyx_k_26[] = "float32";
+static PyObject *__pyx_kp_26;
+static char __pyx_k_magic[] = "magic";
+static PyObject *__pyx_kp_magic;
+static char __pyx_k_29[] = "write_uint32";
+static PyObject *__pyx_kp_29;
+static char __pyx_k_write[] = "write";
+static PyObject *__pyx_kp_write;
+static char __pyx_k_char[] = "char";
+static PyObject *__pyx_kp_char;
+static char __pyx_k_range[] = "range";
+static PyObject *__pyx_kp_range;
+static char __pyx_k_31[] = "read_uint32";
+static PyObject *__pyx_kp_31;
+static char __pyx_k_read[] = "read";
+static PyObject *__pyx_kp_read;
+static char __pyx_k_root[] = "root";
+static PyObject *__pyx_kp_root;
+static char __pyx_k_nan[] = "nan";
+static PyObject *__pyx_kp_nan;
+static char __pyx_k_empty[] = "empty";
+static PyObject *__pyx_kp_empty;
+static char __pyx_k_values[] = "values";
+static PyObject *__pyx_kp_values;
+static char __pyx_k_sum[] = "sum";
+static PyObject *__pyx_kp_sum;
+static char __pyx_k_isnan[] = "isnan";
+static PyObject *__pyx_kp_isnan;
+static char __pyx_k_nanmin[] = "nanmin";
+static PyObject *__pyx_kp_nanmin;
+static char __pyx_k_nanmax[] = "nanmax";
+static PyObject *__pyx_kp_nanmax;
+static char __pyx_k_nansum[] = "nansum";
+static PyObject *__pyx_kp_nansum;
+static char __pyx_k_summary[] = "summary";
+static PyObject *__pyx_kp_summary;
+static char __pyx_k_counts[] = "counts";
+static PyObject *__pyx_kp_counts;
+static char __pyx_k_mins[] = "mins";
+static PyObject *__pyx_kp_mins;
+static char __pyx_k_maxs[] = "maxs";
+static PyObject *__pyx_kp_maxs;
+static char __pyx_k_sums[] = "sums";
+static PyObject *__pyx_kp_sums;
+static char __pyx_k_sumsquares[] = "sumsquares";
+static PyObject *__pyx_kp_sumsquares;
+static char __pyx_k_tell[] = "tell";
+static PyObject *__pyx_kp_tell;
+static char __pyx_k_write_raw_array[] = "write_raw_array";
+static PyObject *__pyx_kp_write_raw_array;
+static char __pyx_k_skip[] = "skip";
+static PyObject *__pyx_kp_skip;
+static char __pyx_k_itemsize[] = "itemsize";
+static PyObject *__pyx_kp_itemsize;
+static char __pyx_k_seek[] = "seek";
+static PyObject *__pyx_kp_seek;
+static char __pyx_k_33[] = "write_uint64";
+static PyObject *__pyx_kp_33;
+static char __pyx_k_start_offset[] = "start_offset";
+static PyObject *__pyx_kp_start_offset;
+static char __pyx_k_read_raw_array[] = "read_raw_array";
+static PyObject *__pyx_kp_read_raw_array;
+static char __pyx_k_34[] = "read_uint64";
+static PyObject *__pyx_kp_34;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_sum;
+static PyObject *__pyx_kp_28;
+static char __pyx_k_28[] = "max < block_size not yet handled";
+static PyObject *__pyx_kp_30;
+static char __pyx_k_30[] = "\000\000\000";
+static PyObject *__pyx_kp_32;
+static char __pyx_k_32[] = "Writing without summaries is currently not supported";
+static char __pyx_k___getbuffer__[] = "__getbuffer__";
+static PyObject *__pyx_kp___getbuffer__;
+static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
+static PyObject *__pyx_kp___releasebuffer__;
+static char __pyx_k_info[] = "info";
+static PyObject *__pyx_kp_info;
+static char __pyx_k_flags[] = "flags";
+static PyObject *__pyx_kp_flags;
+static char __pyx_k_ValueError[] = "ValueError";
+static PyObject *__pyx_kp_ValueError;
+static char __pyx_k_itervalues[] = "itervalues";
+static PyObject *__pyx_kp_itervalues;
+static char __pyx_k_RuntimeError[] = "RuntimeError";
+static PyObject *__pyx_kp_RuntimeError;
+static PyObject *__pyx_kp_1;
+static PyObject *__pyx_kp_2;
+static PyObject *__pyx_kp_20;
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_RuntimeError;
+static char __pyx_k_1[] = "ndarray is not C contiguous";
+static char __pyx_k_2[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_3[] = "b";
+static char __pyx_k_4[] = "B";
+static char __pyx_k_5[] = "h";
+static char __pyx_k_6[] = "H";
+static char __pyx_k_7[] = "i";
+static char __pyx_k_8[] = "I";
+static char __pyx_k_9[] = "l";
+static char __pyx_k_10[] = "L";
+static char __pyx_k_11[] = "q";
+static char __pyx_k_12[] = "Q";
+static char __pyx_k_13[] = "f";
+static char __pyx_k_14[] = "d";
+static char __pyx_k_15[] = "g";
+static char __pyx_k_16[] = "Zf";
+static char __pyx_k_17[] = "Zd";
+static char __pyx_k_18[] = "Zg";
+static char __pyx_k_19[] = "O";
+static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)";
+static PyObject *__pyx_kp_21;
+static PyObject *__pyx_kp_22;
+static char __pyx_k_21[] = "Format string allocated too short.";
+static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)";
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":91
+ *     cdef object dtype
+ *     cdef int levels
+ *     cdef public ArrayTreeNode root             # <<<<<<<<<<<<<<
+ * 
+ *     def __init__( self, int max, int block_size, dtype=float32 ):
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_SetupRefcountContext("__get__");
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root));
+  __pyx_r = ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+  int __pyx_r;
+  __Pyx_SetupRefcountContext("__set__");
+  if (!(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(__pyx_v_value);
+  __Pyx_GIVEREF(__pyx_v_value);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root));
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_value);
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.root.__set__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":93
+ *     cdef public ArrayTreeNode root
+ * 
+ *     def __init__( self, int max, int block_size, dtype=float32 ):             # <<<<<<<<<<<<<<
+ *         """
+ *         Create a new array tree of size `max`
+ */
+
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_2bx_6arrays_10array_tree_9ArrayTree___init__[] = "\n        Create a new array tree of size `max` \n        ";
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  int __pyx_v_max;
+  int __pyx_v_block_size;
+  PyObject *__pyx_v_dtype = 0;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_max,&__pyx_kp_block_size,&__pyx_kp_dtype,0};
+  __Pyx_SetupRefcountContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[3] = {0,0,0};
+    values[2] = __pyx_k_27;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_max);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_block_size);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      if (kw_args > 1) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_dtype);
+        if (unlikely(value)) { values[2] = value; kw_args--; }
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_max = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_dtype = values[2];
+  } else {
+    __pyx_v_dtype = __pyx_k_27;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  3:
+      __pyx_v_dtype = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2:
+      __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_max = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__init__");
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":97
+ *         Create a new array tree of size `max`
+ *         """
+ *         self.max = max             # <<<<<<<<<<<<<<
+ *         self.block_size = block_size
+ *         # Force the dtype argument to its canonical dtype object
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max = __pyx_v_max;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":98
+ *         """
+ *         self.max = max
+ *         self.block_size = block_size             # <<<<<<<<<<<<<<
+ *         # Force the dtype argument to its canonical dtype object
+ *         self.dtype = numpy.dtype( dtype )
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size = __pyx_v_block_size;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
+ *         self.block_size = block_size
+ *         # Force the dtype argument to its canonical dtype object
+ *         self.dtype = numpy.dtype( dtype )             # <<<<<<<<<<<<<<
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0
+ */
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_v_dtype);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dtype);
+  __Pyx_GIVEREF(__pyx_v_dtype);
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype);
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":102
+ *         self.dtype = numpy.dtype( dtype )
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0             # <<<<<<<<<<<<<<
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:
+ *             self.levels += 1
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":103
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:             # <<<<<<<<<<<<<<
+ *             self.levels += 1
+ *         # Not yet dealing with the case where the root is a Leaf
+ */
+  while (1) {
+    __pyx_t_3 = (__Pyx_pow_long(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size, (((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels + 1)) < ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max);
+    if (!__pyx_t_3) break;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":104
+ *         self.levels = 0
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:
+ *             self.levels += 1             # <<<<<<<<<<<<<<
+ *         # Not yet dealing with the case where the root is a Leaf
+ *         assert self.levels > 0, "max < block_size not yet handled"
+ */
+    ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels += 1;
+  }
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":106
+ *             self.levels += 1
+ *         # Not yet dealing with the case where the root is a Leaf
+ *         assert self.levels > 0, "max < block_size not yet handled"             # <<<<<<<<<<<<<<
+ *         # Create the root node
+ *         self.root = ArrayTreeNode( self, 0, max, block_size, self.levels )
+ */
+  #ifndef PYREX_WITHOUT_ASSERTIONS
+  if (unlikely(!(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels > 0))) {
+    PyErr_SetObject(PyExc_AssertionError, __pyx_kp_28);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":108
+ *         assert self.levels > 0, "max < block_size not yet handled"
+ *         # Create the root node
+ *         self.root = ArrayTreeNode( self, 0, max, block_size, self.levels )             # <<<<<<<<<<<<<<
+ * 
+ *     def __setitem__( self, int index, value ):
+ */
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __Pyx_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
+  __Pyx_GIVEREF(__pyx_v_self);
+  __Pyx_INCREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
+  __Pyx_GIVEREF(__pyx_int_0);
+  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_2 = 0;
+  __pyx_t_1 = 0;
+  __pyx_t_4 = 0;
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(__pyx_t_4);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root));
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_t_4);
+  __pyx_t_4 = 0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":110
+ *         self.root = ArrayTreeNode( self, 0, max, block_size, self.levels )
+ * 
+ *     def __setitem__( self, int index, value ):             # <<<<<<<<<<<<<<
+ *         self.root.set( index, value )
+ * 
+ */
+
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index, PyObject *__pyx_v_value) {
+  int __pyx_v_index;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  __Pyx_SetupRefcountContext("__setitem__");
+  assert(__pyx_arg_index); {
+    __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__setitem__");
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":111
+ * 
+ *     def __setitem__( self, int index, value ):
+ *         self.root.set( index, value )             # <<<<<<<<<<<<<<
+ * 
+ *     def __getitem__( self, int index ):
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_kp_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_v_value);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_value);
+  __Pyx_GIVEREF(__pyx_v_value);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__setitem__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":113
+ *         self.root.set( index, value )
+ * 
+ *     def __getitem__( self, int index ):             # <<<<<<<<<<<<<<
+ *         return self.root.get( index )
+ * 
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) {
+  int __pyx_v_index;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  __Pyx_SetupRefcountContext("__getitem__");
+  assert(__pyx_arg_index); {
+    __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__getitem__");
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":114
+ * 
+ *     def __getitem__( self, int index ):
+ *         return self.root.get( index )             # <<<<<<<<<<<<<<
+ * 
+ *     def to_file( self, f ):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_kp_get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__getitem__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":116
+ *         return self.root.get( index )
+ * 
+ *     def to_file( self, f ):             # <<<<<<<<<<<<<<
+ *         io = BinaryFileWriter( f, magic=MAGIC )
+ *         io.write_uint32( VERSION )
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_to_file(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_to_file(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
+  PyObject *__pyx_v_io;
+  PyObject *__pyx_v_level;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  Py_ssize_t __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  __Pyx_SetupRefcountContext("to_file");
+  __pyx_v_io = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_level = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":117
+ * 
+ *     def to_file( self, f ):
+ *         io = BinaryFileWriter( f, magic=MAGIC )             # <<<<<<<<<<<<<<
+ *         io.write_uint32( VERSION )
+ *         io.write_uint32( self.max )
+ */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileWriter); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_v_f);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f);
+  __Pyx_GIVEREF(__pyx_v_f);
+  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_2));
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_3);
+  if (PyDict_SetItem(__pyx_2, __pyx_kp_magic, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+  __Pyx_DECREF(__pyx_v_io);
+  __pyx_v_io = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":118
+ *     def to_file( self, f ):
+ *         io = BinaryFileWriter( f, magic=MAGIC )
+ *         io.write_uint32( VERSION )             # <<<<<<<<<<<<<<
+ *         io.write_uint32( self.max )
+ *         io.write_uint32( self.block_size )
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_3);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_3);
+  __Pyx_GIVEREF(__pyx_3);
+  __pyx_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":119
+ *         io = BinaryFileWriter( f, magic=MAGIC )
+ *         io.write_uint32( VERSION )
+ *         io.write_uint32( self.max )             # <<<<<<<<<<<<<<
+ *         io.write_uint32( self.block_size )
+ *         io.write( self.dtype.char )
+ */
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":120
+ *         io.write_uint32( VERSION )
+ *         io.write_uint32( self.max )
+ *         io.write_uint32( self.block_size )             # <<<<<<<<<<<<<<
+ *         io.write( self.dtype.char )
+ *         io.write( "\0\0\0" )
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":121
+ *         io.write_uint32( self.max )
+ *         io.write_uint32( self.block_size )
+ *         io.write( self.dtype.char )             # <<<<<<<<<<<<<<
+ *         io.write( "\0\0\0" )
+ *         # Data pass, level order
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype, __pyx_kp_char); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":122
+ *         io.write_uint32( self.block_size )
+ *         io.write( self.dtype.char )
+ *         io.write( "\0\0\0" )             # <<<<<<<<<<<<<<
+ *         # Data pass, level order
+ *         for level in range( self.levels, -1, -1 ):
+ */
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_kp_30);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_30);
+  __Pyx_GIVEREF(__pyx_kp_30);
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":124
+ *         io.write( "\0\0\0" )
+ *         # Data pass, level order
+ *         for level in range( self.levels, -1, -1 ):             # <<<<<<<<<<<<<<
+ *             self.root.to_file_data_pass( io, level )
+ *         # Offset pass to fix up indexes
+ */
+  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_int_neg_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_neg_1);
+  __Pyx_GIVEREF(__pyx_int_neg_1);
+  __Pyx_INCREF(__pyx_int_neg_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_neg_1);
+  __Pyx_GIVEREF(__pyx_int_neg_1);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+    __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1);
+  } else {
+    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+  }
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_1))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } else {
+      __pyx_t_2 = PyIter_Next(__pyx_t_1);
+      if (!__pyx_t_2) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_2);
+    }
+    __Pyx_DECREF(__pyx_v_level);
+    __pyx_v_level = __pyx_t_2;
+    __pyx_t_2 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":125
+ *         # Data pass, level order
+ *         for level in range( self.levels, -1, -1 ):
+ *             self.root.to_file_data_pass( io, level )             # <<<<<<<<<<<<<<
+ *         # Offset pass to fix up indexes
+ *         self.root.to_file_offset_pass( io )
+ */
+    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_kp_to_file_data_pass); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_INCREF(__pyx_v_io);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_io);
+    __Pyx_GIVEREF(__pyx_v_io);
+    __Pyx_INCREF(__pyx_v_level);
+    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_level);
+    __Pyx_GIVEREF(__pyx_v_level);
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":127
+ *             self.root.to_file_data_pass( io, level )
+ *         # Offset pass to fix up indexes
+ *         self.root.to_file_offset_pass( io )             # <<<<<<<<<<<<<<
+ * 
+ *     @classmethod
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root), __pyx_kp_to_file_offset_pass); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __Pyx_INCREF(__pyx_v_io);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_io);
+  __Pyx_GIVEREF(__pyx_v_io);
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_2);
+  __Pyx_XDECREF(__pyx_3);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.to_file");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_io);
+  __Pyx_DECREF(__pyx_v_level);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":130
+ * 
+ *     @classmethod
+ *     def from_file( Class, f ):             # <<<<<<<<<<<<<<
+ *         io = BinaryFileReader( f, magic=MAGIC )
+ *         assert io.read_uint32() == VERSION
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_from_file(PyObject *__pyx_v_Class, PyObject *__pyx_v_f); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_from_file(PyObject *__pyx_v_Class, PyObject *__pyx_v_f) {
+  PyObject *__pyx_v_io;
+  PyObject *__pyx_v_max;
+  PyObject *__pyx_v_block_size;
+  PyObject *__pyx_v_dt;
+  PyObject *__pyx_v_tree;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_SetupRefcountContext("from_file");
+  __pyx_v_io = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_max = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_block_size = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_dt = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_tree = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":131
+ *     @classmethod
+ *     def from_file( Class, f ):
+ *         io = BinaryFileReader( f, magic=MAGIC )             # <<<<<<<<<<<<<<
+ *         assert io.read_uint32() == VERSION
+ *         max = io.read_uint32()
+ */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileReader); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_1);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_v_f);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_f);
+  __Pyx_GIVEREF(__pyx_v_f);
+  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_2));
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_3);
+  if (PyDict_SetItem(__pyx_2, __pyx_kp_magic, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+  __Pyx_DECREF(__pyx_v_io);
+  __pyx_v_io = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":132
+ *     def from_file( Class, f ):
+ *         io = BinaryFileReader( f, magic=MAGIC )
+ *         assert io.read_uint32() == VERSION             # <<<<<<<<<<<<<<
+ *         max = io.read_uint32()
+ *         block_size = io.read_uint32()
+ */
+  #ifndef PYREX_WITHOUT_ASSERTIONS
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_31); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_3);
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_3, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (unlikely(!__pyx_t_3)) {
+    PyErr_SetNone(PyExc_AssertionError);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":133
+ *         io = BinaryFileReader( f, magic=MAGIC )
+ *         assert io.read_uint32() == VERSION
+ *         max = io.read_uint32()             # <<<<<<<<<<<<<<
+ *         block_size = io.read_uint32()
+ *         dt = io.read( 1 )
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_31); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_v_max);
+  __pyx_v_max = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":134
+ *         assert io.read_uint32() == VERSION
+ *         max = io.read_uint32()
+ *         block_size = io.read_uint32()             # <<<<<<<<<<<<<<
+ *         dt = io.read( 1 )
+ *         io.read( 3 )
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_v_block_size);
+  __pyx_v_block_size = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":135
+ *         max = io.read_uint32()
+ *         block_size = io.read_uint32()
+ *         dt = io.read( 1 )             # <<<<<<<<<<<<<<
+ *         io.read( 3 )
+ *         tree = Class( max, block_size, dt )
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
+  __Pyx_GIVEREF(__pyx_int_1);
+  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_v_dt);
+  __pyx_v_dt = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":136
+ *         block_size = io.read_uint32()
+ *         dt = io.read( 1 )
+ *         io.read( 3 )             # <<<<<<<<<<<<<<
+ *         tree = Class( max, block_size, dt )
+ *         tree.root.from_file( io )
+ */
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_int_3);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_3);
+  __Pyx_GIVEREF(__pyx_int_3);
+  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":137
+ *         dt = io.read( 1 )
+ *         io.read( 3 )
+ *         tree = Class( max, block_size, dt )             # <<<<<<<<<<<<<<
+ *         tree.root.from_file( io )
+ *         return tree
+ */
+  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_v_max);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_max);
+  __Pyx_GIVEREF(__pyx_v_max);
+  __Pyx_INCREF(__pyx_v_block_size);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_block_size);
+  __Pyx_GIVEREF(__pyx_v_block_size);
+  __Pyx_INCREF(__pyx_v_dt);
+  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_dt);
+  __Pyx_GIVEREF(__pyx_v_dt);
+  __pyx_t_1 = PyObject_Call(__pyx_v_Class, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_v_tree);
+  __pyx_v_tree = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":138
+ *         io.read( 3 )
+ *         tree = Class( max, block_size, dt )
+ *         tree.root.from_file( io )             # <<<<<<<<<<<<<<
+ *         return tree
+ * 
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_tree, __pyx_kp_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_from_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(__pyx_v_io);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_io);
+  __Pyx_GIVEREF(__pyx_v_io);
+  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":139
+ *         tree = Class( max, block_size, dt )
+ *         tree.root.from_file( io )
+ *         return tree             # <<<<<<<<<<<<<<
+ * 
+ *     @classmethod
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(__pyx_v_tree);
+  __pyx_r = __pyx_v_tree;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_2);
+  __Pyx_XDECREF(__pyx_3);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_file");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_io);
+  __Pyx_DECREF(__pyx_v_max);
+  __Pyx_DECREF(__pyx_v_block_size);
+  __Pyx_DECREF(__pyx_v_dt);
+  __Pyx_DECREF(__pyx_v_tree);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":142
+ * 
+ *     @classmethod
+ *     def from_sequence( Class, s, block_size=1000 ):             # <<<<<<<<<<<<<<
+ *         """
+ *         Build an ArrayTree from a sequence like object (must have at least
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_from_sequence(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_2bx_6arrays_10array_tree_9ArrayTree_from_sequence[] = "\n        Build an ArrayTree from a sequence like object (must have at least\n        length and getitem).\n        ";
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_from_sequence(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_s = 0;
+  PyObject *__pyx_v_block_size = 0;
+  PyObject *__pyx_v_tree;
+  PyObject *__pyx_v_i;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  Py_ssize_t __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  Py_ssize_t __pyx_t_4;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_s,&__pyx_kp_block_size,0};
+  __Pyx_SetupRefcountContext("from_sequence");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[2] = {0,0};
+    values[1] = __pyx_int_1000;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_s);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      if (kw_args > 1) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_block_size);
+        if (unlikely(value)) { values[1] = value; kw_args--; }
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "from_sequence") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_s = values[0];
+    __pyx_v_block_size = values[1];
+  } else {
+    __pyx_v_block_size = __pyx_int_1000;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: __pyx_v_block_size = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: __pyx_v_s = PyTuple_GET_ITEM(__pyx_args, 0);
+      break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("from_sequence", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_sequence");
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_v_tree = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":147
+ *         length and getitem).
+ *         """
+ *         tree = Class( len( s ), block_size )             # <<<<<<<<<<<<<<
+ *         for i in range( len( s ) ):
+ *             tree[i] = s[i]
+ */
+  __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_v_block_size);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_block_size);
+  __Pyx_GIVEREF(__pyx_v_block_size);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_v_Class, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_v_tree);
+  __pyx_v_tree = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":148
+ *         """
+ *         tree = Class( len( s ), block_size )
+ *         for i in range( len( s ) ):             # <<<<<<<<<<<<<<
+ *             tree[i] = s[i]
+ *         return tree
+ */
+  __pyx_t_4 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
+    __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
+  } else {
+    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+  }
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
+    } else {
+      __pyx_t_2 = PyIter_Next(__pyx_t_3);
+      if (!__pyx_t_2) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_2);
+    }
+    __Pyx_DECREF(__pyx_v_i);
+    __pyx_v_i = __pyx_t_2;
+    __pyx_t_2 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":149
+ *         tree = Class( len( s ), block_size )
+ *         for i in range( len( s ) ):
+ *             tree[i] = s[i]             # <<<<<<<<<<<<<<
+ *         return tree
+ * 
+ */
+    __pyx_1 = PyObject_GetItem(__pyx_v_s, __pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_1);
+    if (PyObject_SetItem(__pyx_v_tree, __pyx_v_i, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  }
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":150
+ *         for i in range( len( s ) ):
+ *             tree[i] = s[i]
+ *         return tree             # <<<<<<<<<<<<<<
+ * 
+ * cdef class ArrayTreeNode:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(__pyx_v_tree);
+  __pyx_r = __pyx_v_tree;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.from_sequence");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_tree);
+  __Pyx_DECREF(__pyx_v_i);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":165
+ *     cdef int child_size
+ *     cdef object children
+ *     cdef public Summary summary             # <<<<<<<<<<<<<<
+ *     cdef public long start_offset
+ * 
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___get__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_SetupRefcountContext("__get__");
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary));
+  __pyx_r = ((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode_7summary___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
+  int __pyx_r;
+  __Pyx_SetupRefcountContext("__set__");
+  if (!(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_Summary))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(__pyx_v_value);
+  __Pyx_GIVEREF(__pyx_v_value);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary));
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)__pyx_v_value);
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.summary.__set__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":168
+ *     cdef public long start_offset
+ * 
+ *     def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ):             # <<<<<<<<<<<<<<
+ *         self.tree = tree
+ *         self.min = min
+ */
+
+static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_13ArrayTreeNode___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *__pyx_v_tree = 0;
+  int __pyx_v_min;
+  int __pyx_v_max;
+  int __pyx_v_block_size;
+  int __pyx_v_level;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_tree,&__pyx_kp_min,&__pyx_kp_max,&__pyx_kp_block_size,&__pyx_kp_level,0};
+  __Pyx_SetupRefcountContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[5] = {0,0,0,0,0};
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_tree);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_min);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_max);
+      if (likely(values[2])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  3:
+      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_block_size);
+      if (likely(values[3])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  4:
+      values[4] = PyDict_GetItem(__pyx_kwds, __pyx_kp_level);
+      if (likely(values[4])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)values[0]);
+    __pyx_v_min = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_max = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_block_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_level = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_tree = ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)PyTuple_GET_ITEM(__pyx_args, 0));
+    __pyx_v_min = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_min == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_max = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.__init__");
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_2bx_6arrays_10array_tree_ArrayTree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":169
+ * 
+ *     def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ):
+ *         self.tree = tree             # <<<<<<<<<<<<<<
+ *         self.min = min
+ *         self.max = max
+ */
+  __Pyx_INCREF(((PyObject *)__pyx_v_tree));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_tree));
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree));
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->tree = __pyx_v_tree;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":170
+ *     def __init__( self, ArrayTree tree, int min, int max, int block_size, int level ):
+ *         self.tree = tree
+ *         self.min = min             # <<<<<<<<<<<<<<
+ *         self.max = max
+ *         self.block_size = block_size
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->min = __pyx_v_min;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":171
+ *         self.tree = tree
+ *         self.min = min
+ *         self.max = max             # <<<<<<<<<<<<<<
+ *         self.block_size = block_size
+ *         self.level = level
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->max = __pyx_v_max;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":172
+ *         self.min = min
+ *         self.max = max
+ *         self.block_size = block_size             # <<<<<<<<<<<<<<
+ *         self.level = level
+ *         # Each of my children represents block_size ** level values
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size = __pyx_v_block_size;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":173
+ *         self.max = max
+ *         self.block_size = block_size
+ *         self.level = level             # <<<<<<<<<<<<<<
+ *         # Each of my children represents block_size ** level values
+ *         self.child_size = self.block_size ** self.level
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->level = __pyx_v_level;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":175
+ *         self.level = level
+ *         # Each of my children represents block_size ** level values
+ *         self.child_size = self.block_size ** self.level             # <<<<<<<<<<<<<<
+ *         self.children = [None] * self.block_size
+ *         self.summary = None
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->child_size = __Pyx_pow_int(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size, ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->level);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":176
+ *         # Each of my children represents block_size ** level values
+ *         self.child_size = self.block_size ** self.level
+ *         self.children = [None] * self.block_size             # <<<<<<<<<<<<<<
+ *         self.summary = None
+ *         self.start_offset = 0
+ */
+  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __Pyx_INCREF(Py_None);
+  PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
+  __Pyx_GIVEREF(Py_None);
+  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->block_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_GIVEREF(__pyx_t_3);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children);
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->children = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":177
+ *         self.child_size = self.block_size ** self.level
+ *         self.children = [None] * self.block_size
+ *         self.summary = None             # <<<<<<<<<<<<<<
+ *         self.start_offset = 0
+ * 
+ */
+  __Pyx_INCREF(Py_None);
+  __Pyx_GIVEREF(Py_None);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary));
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->summary = ((struct __pyx_obj_2bx_6arrays_10array_tree_Summary *)Py_None);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":178
+ *         self.children = [None] * self.block_size
+ *         self.summary = None
+ *         self.start_offset = 0             # <<<<<<<<<<<<<<
+ * 
+ *     cdef inline init_bin( self, int index ):
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *)__pyx_v_self)->start_offset = 0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTreeNode.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":180
+ *         self.start_offset = 0
+ * 
+ *     cdef inline init_bin( self, int index ):             # <<<<<<<<<<<<<<
+ *         cdef int min = self.min + ( index * self.child_size )
+ *         cdef int max = min + self.child_size
+ */
+
+static INLINE PyObject *__pyx_f_2bx_6arrays_10array_tree_13ArrayTreeNode_init_bin(struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *__pyx_v_self, int __pyx_v_index) {
+  int __pyx_v_min;
+  int __pyx_v_max;
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  __Pyx_SetupRefcountContext("init_bin");
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":181
+ * 
+ *     cdef inline init_bin( self, int index ):
+ *         cdef int min = self.min + ( index * self.child_size )             # <<<<<<<<<<<<<<
+ *         cdef int max = min + self.child_size
+ *         if self.level == 1:
+ */
+  __pyx_v_min = (__pyx_v_self->min + (__pyx_v_index * __pyx_v_self->child_size));
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":182
+ *     cdef inline init_bin( self, int index ):
+ *         cdef int min = self.min + ( index * self.child_size )
+ *         cdef int max = min + self.child_size             # <<<<<<<<<<<<<<
+ *         if self.level == 1:
+ *             self.children[ index ] = ArrayTreeLeaf( self.tree, min, max )
+ */
+  __pyx_v_max = (__pyx_v_min + __pyx_v_self->child_size);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":183
+ *         cdef int min = self.min + ( index * self.child_size )
+ *         cdef int max = min + self.child_size
+ *         if self.level == 1:             # <<<<<<<<<<<<<<
+ *             self.children[ index ] = ArrayTreeLeaf( self.tree, min, max )
+ *         else:
+ */
+  __pyx_t_1 = (__pyx_v_self->level == 1);
+  if (__pyx_t_1) {
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":184
+ *         cdef int max = min + self.child_size
+ *         if self.level == 1:
+ *             self.children[ index ] = ArrayTreeLeaf( self.tree, min, max )             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.children[ index ] = ArrayTreeNode( self.tree, min, max, self.block_size, self.level - 1 )
+ */
+    __pyx_t_2 = PyInt_FromLong(__pyx_v_min); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    __Pyx_INCREF(((PyObject *)__pyx_v_self->tree));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->tree));
+    __Pyx_GIVEREF(((PyObject *)__pyx_v_self->tree));
+    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+    __Pyx_GIVEREF(__pyx_t_2);
+    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
+    __Pyx_GIVEREF(__pyx_t_3);
+    __pyx_t_2 = 0;
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    if (__Pyx_SetItemInt(__pyx_v_self->children, __pyx_v_index, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree