Commits

James Taylor committed 405b4a4

Working on FileArrayTree, now supports direct access to a complete leaf or single summary

Comments (0)

Files changed (7)

lib/bx/arrays/array_tree.c

-/* Generated by Cython 0.11.1 on Wed Aug 12 14:23:03 2009 */
+/* Generated by Cython 0.11.2 on Wed Sep 16 18:51:18 2009 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   #ifndef __cdecl
     #define __cdecl
   #endif
+  #ifndef __fastcall
+    #define __fastcall
+  #endif
 #else
   #define _USE_MATH_DEFINES
 #endif
 #define __PYX_HAVE_API__bx__arrays__array_tree
 #include "stdlib.h"
 #include "numpy/arrayobject.h"
+#define __PYX_USE_C99_COMPLEX defined(_Complex_I)
 
 
 #ifdef __GNUC__
 static const char *__pyx_filename;
 static const char **__pyx_f;
 
+
 #ifdef CYTHON_REFNANNY
 typedef struct {
   void (*INCREF)(void*, PyObject*, int);
 static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
 static int __Pyx_EndUnpack(PyObject *); /*proto*/
 
-static INLINE long __Pyx_pow_long(long, long); /* proto */
+static INLINE PY_LONG_LONG __Pyx_pow_PY_LONG_LONG(PY_LONG_LONG, PY_LONG_LONG); /* proto */
+
+static int __Pyx_Print(PyObject *, int); /*proto*/
+#if PY_MAJOR_VERSION >= 3
+static PyObject* __pyx_print = 0;
+static PyObject* __pyx_print_kwargs = 0;
+#endif
 
 static INLINE int __Pyx_pow_int(int, int); /* proto */
 
+#if __PYX_USE_C99_COMPLEX
+    #define __Pyx_REAL_PART(z) __real__(z)
+    #define __Pyx_IMAG_PART(z) __imag__(z)
+#else
+    #define __Pyx_REAL_PART(z) ((z).real)
+    #define __Pyx_IMAG_PART(z) ((z).imag)
+#endif
+
+#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z))
+
+#if __PYX_USE_C99_COMPLEX
+
+    typedef float _Complex __pyx_t_float_complex;
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      return x + y*(__pyx_t_float_complex)_Complex_I;
+    }
+    
+    #define __pyx_t_float_complex_is_zero(a) ((a) == 0)
+    #define __pyx_t_float_complex_eq(a, b) ((a) == (b))
+    #define __pyx_t_float_complex_add(a, b) ((a)+(b))
+    #define __pyx_t_float_complex_sub(a, b) ((a)-(b))
+    #define __pyx_t_float_complex_mul(a, b) ((a)*(b))
+    #define __pyx_t_float_complex_div(a, b) ((a)/(b))
+    #define __pyx_t_float_complex_neg(a) (-(a))
+
+#else
+
+    typedef struct { float real, imag; } __pyx_t_float_complex;
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      __pyx_t_float_complex c; c.real = x; c.imag = y; return c;
+    }
+    
+    static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) {
+       return (a.real == 0) & (a.imag == 0);
+    }
+
+    static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+       return (a.real == b.real) & (a.imag == b.imag);
+    }
+
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        float denom = b.real*b.real + b.imag*b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+
+    static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) {
+        __pyx_t_float_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+
+#endif
+
+#if __PYX_USE_C99_COMPLEX
+
+    typedef double _Complex __pyx_t_double_complex;
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      return x + y*(__pyx_t_double_complex)_Complex_I;
+    }
+    
+    #define __pyx_t_double_complex_is_zero(a) ((a) == 0)
+    #define __pyx_t_double_complex_eq(a, b) ((a) == (b))
+    #define __pyx_t_double_complex_add(a, b) ((a)+(b))
+    #define __pyx_t_double_complex_sub(a, b) ((a)-(b))
+    #define __pyx_t_double_complex_mul(a, b) ((a)*(b))
+    #define __pyx_t_double_complex_div(a, b) ((a)/(b))
+    #define __pyx_t_double_complex_neg(a) (-(a))
+
+#else
+
+    typedef struct { double real, imag; } __pyx_t_double_complex;
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      __pyx_t_double_complex c; c.real = x; c.imag = y; return c;
+    }
+    
+    static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) {
+       return (a.real == 0) & (a.imag == 0);
+    }
+
+    static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+       return (a.real == b.real) & (a.imag == b.imag);
+    }
+
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        double denom = b.real*b.real + b.imag*b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+
+    static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) {
+        __pyx_t_double_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+
+#endif
+
+#if __PYX_USE_C99_COMPLEX
+
+    typedef long double _Complex __pyx_t_long__double_complex;
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
+      return x + y*(__pyx_t_long__double_complex)_Complex_I;
+    }
+    
+    #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0)
+    #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b))
+    #define __pyx_t_long__double_complex_add(a, b) ((a)+(b))
+    #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b))
+    #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b))
+    #define __pyx_t_long__double_complex_div(a, b) ((a)/(b))
+    #define __pyx_t_long__double_complex_neg(a) (-(a))
+
+#else
+
+    typedef struct { long double real, imag; } __pyx_t_long__double_complex;
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) {
+      __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c;
+    }
+    
+    static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) {
+       return (a.real == 0) & (a.imag == 0);
+    }
+
+    static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
+       return (a.real == b.real) & (a.imag == b.imag);
+    }
+
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
+        __pyx_t_long__double_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
+        __pyx_t_long__double_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
+        __pyx_t_long__double_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) {
+        __pyx_t_long__double_complex z;
+        long double denom = b.real*b.real + b.imag*b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+
+    static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) {
+        __pyx_t_long__double_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+
+#endif
+
 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 signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
+static void __Pyx_WriteUnraisable(const char *name); /*proto*/
+
 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
 
 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size);  /*proto*/
 
 typedef npy_float64 __pyx_t_5numpy_float64_t;
 
+typedef npy_complex64 __pyx_t_5numpy_complex64_t;
+
+typedef npy_complex128 __pyx_t_5numpy_complex128_t;
+
 typedef npy_long __pyx_t_5numpy_int_t;
 
 typedef npy_longlong __pyx_t_5numpy_long_t;
 
 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":149
- *             return self.io.read_raw_array( self.dtype, 1 )[0]
+typedef npy_cdouble __pyx_t_5numpy_complex_t;
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/wiggle.pxd":1
+ * cdef enum linemode:             # <<<<<<<<<<<<<<
+ *     MODE_BED
+ *     MODE_FIXED
+ */
+
+enum __pyx_t_2bx_6arrays_6wiggle_linemode {
+  __pyx_e_2bx_6arrays_6wiggle_MODE_BED,
+  __pyx_e_2bx_6arrays_6wiggle_MODE_FIXED,
+  __pyx_e_2bx_6arrays_6wiggle_MODE_VARIABLE
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":200
+ *             return min
  * 
  * cdef class Summary:             # <<<<<<<<<<<<<<
  *     """
   PyObject *sumsquares;
 };
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":161
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":212
  * 
  * cdef class ArrayTreeNode
  * cdef class ArrayTreeLeaf             # <<<<<<<<<<<<<<
   long start_offset;
 };
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":119
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  * 
  * cdef class FileArrayTree:             # <<<<<<<<<<<<<<
   PyObject *io;
 };
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":163
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":214
  * cdef class ArrayTreeLeaf
  * 
  * cdef class ArrayTree:             # <<<<<<<<<<<<<<
   struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *root;
 };
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":59
- * VERSION = 0
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":78
+ * 
  * 
  * cdef class FileArrayTreeDict:             # <<<<<<<<<<<<<<
  *     """
   PyObject *cdb_dict;
 };
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":160
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":211
  *     cdef public object sumsquares
  * 
  * cdef class ArrayTreeNode             # <<<<<<<<<<<<<<
   long start_offset;
 };
 
-
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/wiggle.pxd":6
+ *     MODE_VARIABLE
+ * 
+ * cdef class IntervalReader:             # <<<<<<<<<<<<<<
+ *     cdef object file
+ *     cdef object current_chrom
+ */
+
+struct __pyx_obj_2bx_6arrays_6wiggle_IntervalReader {
+  PyObject_HEAD
+  PyObject *file;
+  PyObject *current_chrom;
+  long current_pos;
+  long current_step;
+  long current_span;
+  enum __pyx_t_2bx_6arrays_6wiggle_linemode mode;
+};
+
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":119
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  * 
  * cdef class FileArrayTree:             # <<<<<<<<<<<<<<
  */
 
 struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree {
-  PyObject *(*r_get_helper)(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *, int, int, PY_LONG_LONG, int);
+  int (*r_seek_to_node)(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *, int, int, PY_LONG_LONG, int, int);
 };
 static struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *__pyx_vtabptr_2bx_6arrays_10array_tree_FileArrayTree;
 
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":249
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":299
  *         return tree
  * 
  * cdef class ArrayTreeNode:             # <<<<<<<<<<<<<<
 
 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*/
+static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
+/* Module declarations from bx.arrays.wiggle */
+
+static PyTypeObject *__pyx_ptype_2bx_6arrays_6wiggle_IntervalReader = 0;
+/* Module declarations from bx.arrays */
+
+/* Module declarations from bx */
+
 /* Module declarations from bx.arrays.array_tree */
 
 static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict = 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_28 = 0;
-static PyObject *__pyx_k_29 = 0;
-static PyObject *__pyx_k_31 = 0;
-static PyObject *__pyx_k_32 = 0;
-static PyObject *__pyx_k_33 = 0;
-
-const char *__pyx_modulename = "bx.arrays.array_tree";
+static PyObject *__pyx_k_37 = 0;
+static PyObject *__pyx_k_38 = 0;
+static PyObject *__pyx_k_40 = 0;
+static PyObject *__pyx_k_41 = 0;
+static PyObject *__pyx_k_42 = 0;
+#define __Pyx_MODULE_NAME "bx.arrays.array_tree"
+int __pyx_module_is_main_bx__arrays__array_tree = 0;
 
 /* Implementation of bx.arrays.array_tree */
 static PyObject *__pyx_int_0x310ec7dc;
 static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_2147483647;
 static PyObject *__pyx_int_1000;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_3;
 static PyObject *__pyx_int_5;
 static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_2;
+static char __pyx_k___main__[] = "__main__";
+static PyObject *__pyx_kp___main__;
 static char __pyx_k___init__[] = "__init__";
 static PyObject *__pyx_kp___init__;
 static char __pyx_k___getitem__[] = "__getitem__";
 static PyObject *__pyx_kp___getitem__;
 static char __pyx_k_dict_to_file[] = "dict_to_file";
 static PyObject *__pyx_kp_dict_to_file;
+static char __pyx_k_get_summary[] = "get_summary";
+static PyObject *__pyx_kp_get_summary;
+static char __pyx_k_get_leaf[] = "get_leaf";
+static PyObject *__pyx_kp_get_leaf;
 static char __pyx_k___setitem__[] = "__setitem__";
 static PyObject *__pyx_kp___setitem__;
 static char __pyx_k_set_range[] = "set_range";
 static PyObject *__pyx_kp_to_file_offset_pass;
 static char __pyx_k_get_from_file[] = "get_from_file";
 static PyObject *__pyx_kp_get_from_file;
+static char __pyx_k_reader[] = "reader";
+static PyObject *__pyx_kp_reader;
+static char __pyx_k_sizes[] = "sizes";
+static PyObject *__pyx_kp_sizes;
+static char __pyx_k_default_size[] = "default_size";
+static PyObject *__pyx_kp_default_size;
+static char __pyx_k_block_size[] = "block_size";
+static PyObject *__pyx_kp_block_size;
 static char __pyx_k_file[] = "file";
 static PyObject *__pyx_kp_file;
 static char __pyx_k_key[] = "key";
 static PyObject *__pyx_kp_is_little_endian;
 static char __pyx_k_index[] = "index";
 static PyObject *__pyx_kp_index;
+static char __pyx_k_level[] = "level";
+static PyObject *__pyx_kp_level;
 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_start[] = "start";
 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_24[] = "FileArrayTreeDict";
-static PyObject *__pyx_kp_24;
+static char __pyx_k_31[] = "ArrayTree";
+static PyObject *__pyx_kp_31;
+static char __pyx_k_32[] = "FileArrayTreeDict";
+static PyObject *__pyx_kp_32;
+static char __pyx_k_33[] = "array_tree_dict_from_wiggle_reader";
+static PyObject *__pyx_kp_33;
 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_25[] = "*";
-static PyObject *__pyx_kp_25;
-static char __pyx_k_26[] = "bx.misc.binary_file";
-static PyObject *__pyx_kp_26;
+static char __pyx_k_34[] = "*";
+static PyObject *__pyx_kp_34;
+static char __pyx_k_35[] = "bx.misc.binary_file";
+static PyObject *__pyx_kp_35;
 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_27[] = "bx.misc.cdb";
-static PyObject *__pyx_kp_27;
+static char __pyx_k_36[] = "bx.misc.cdb";
+static PyObject *__pyx_kp_36;
 static char __pyx_k_FileCDBDict[] = "FileCDBDict";
 static PyObject *__pyx_kp_FileCDBDict;
 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_30[] = "float32";
-static PyObject *__pyx_kp_30;
-static char __pyx_k_34[] = "read_uint32";
-static PyObject *__pyx_kp_34;
+static char __pyx_k_39[] = "float32";
+static PyObject *__pyx_kp_39;
+static char __pyx_k_43[] = "read_uint32";
+static PyObject *__pyx_kp_43;
 static char __pyx_k_unpack[] = "unpack";
 static PyObject *__pyx_kp_unpack;
-static char __pyx_k_35[] = "L";
-static PyObject *__pyx_kp_35;
+static char __pyx_k_44[] = "L";
+static PyObject *__pyx_kp_44;
 static char __pyx_k_seek[] = "seek";
 static PyObject *__pyx_kp_seek;
-static char __pyx_k_36[] = "write_uint32";
-static PyObject *__pyx_kp_36;
+static char __pyx_k_45[] = "write_uint32";
+static PyObject *__pyx_kp_45;
 static char __pyx_k_iterkeys[] = "iterkeys";
 static PyObject *__pyx_kp_iterkeys;
 static char __pyx_k_pack[] = "pack";
 static PyObject *__pyx_kp_pack;
-static char __pyx_k_37[] = "L";
-static PyObject *__pyx_kp_37;
+static char __pyx_k_46[] = "L";
+static PyObject *__pyx_kp_46;
 static char __pyx_k_tell[] = "tell";
 static PyObject *__pyx_kp_tell;
 static char __pyx_k_iteritems[] = "iteritems";
 static PyObject *__pyx_kp_iteritems;
-static char __pyx_k_38[] = "L";
-static PyObject *__pyx_kp_38;
+static char __pyx_k_47[] = "L";
+static PyObject *__pyx_kp_47;
 static char __pyx_k_read[] = "read";
 static PyObject *__pyx_kp_read;
 static char __pyx_k_skip[] = "skip";
 static PyObject *__pyx_kp_skip;
+static char __pyx_k_nan[] = "nan";
+static PyObject *__pyx_kp_nan;
 static char __pyx_k_itemsize[] = "itemsize";
 static PyObject *__pyx_kp_itemsize;
-static char __pyx_k_40[] = "read_uint64";
-static PyObject *__pyx_kp_40;
 static char __pyx_k_read_raw_array[] = "read_raw_array";
 static PyObject *__pyx_kp_read_raw_array;
-static char __pyx_k_range[] = "range";
-static PyObject *__pyx_kp_range;
+static char __pyx_k_counts[] = "counts";
+static PyObject *__pyx_kp_counts;
+static char __pyx_k_sums[] = "sums";
+static PyObject *__pyx_kp_sums;
+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_sumsquares[] = "sumsquares";
+static PyObject *__pyx_kp_sumsquares;
+static char __pyx_k_50[] = "read_uint64";
+static PyObject *__pyx_kp_50;
 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_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_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_write_raw_array[] = "write_raw_array";
 static PyObject *__pyx_kp_write_raw_array;
-static char __pyx_k_44[] = "write_uint64";
-static PyObject *__pyx_kp_44;
+static char __pyx_k_55[] = "write_uint64";
+static PyObject *__pyx_kp_55;
 static char __pyx_k_start_offset[] = "start_offset";
 static PyObject *__pyx_kp_start_offset;
 static PyObject *__pyx_builtin_range;
 static PyObject *__pyx_builtin_sum;
-static PyObject *__pyx_kp_39;
-static char __pyx_k_39[] = "max < block_size not yet handled";
-static PyObject *__pyx_kp_41;
-static char __pyx_k_41[] = "max < block_size not yet handled";
-static PyObject *__pyx_kp_42;
-static char __pyx_k_42[] = "\000\000\000";
-static PyObject *__pyx_kp_43;
-static char __pyx_k_43[] = "Writing without summaries is currently not supported";
+static PyObject *__pyx_kp_48;
+static char __pyx_k_48[] = "max < block_size not yet handled";
+static PyObject *__pyx_kp_49;
+static PyObject *__pyx_kp_51;
+static char __pyx_k_49[] = "~~~~~>";
+static char __pyx_k_51[] = "!!!";
+static PyObject *__pyx_kp_52;
+static char __pyx_k_52[] = "max < block_size not yet handled";
+static PyObject *__pyx_kp_53;
+static char __pyx_k_53[] = "\000\000\000";
+static PyObject *__pyx_kp_54;
+static char __pyx_k_54[] = "Writing without summaries is currently not supported";
+static PyObject *__pyx_int_15;
 static char __pyx_k___getbuffer__[] = "__getbuffer__";
 static PyObject *__pyx_kp___getbuffer__;
 static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
 static PyObject *__pyx_kp_RuntimeError;
 static PyObject *__pyx_kp_1;
 static PyObject *__pyx_kp_2;
-static PyObject *__pyx_kp_20;
+static PyObject *__pyx_kp_5;
+static PyObject *__pyx_kp_23;
 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":65
+static char __pyx_k_3[] = ">";
+static char __pyx_k_4[] = "<";
+static char __pyx_k_5[] = "Non-native byte order not supported";
+static char __pyx_k_6[] = "b";
+static char __pyx_k_7[] = "B";
+static char __pyx_k_8[] = "h";
+static char __pyx_k_9[] = "H";
+static char __pyx_k_10[] = "i";
+static char __pyx_k_11[] = "I";
+static char __pyx_k_12[] = "l";
+static char __pyx_k_13[] = "L";
+static char __pyx_k_14[] = "q";
+static char __pyx_k_15[] = "Q";
+static char __pyx_k_16[] = "f";
+static char __pyx_k_17[] = "d";
+static char __pyx_k_18[] = "g";
+static char __pyx_k_19[] = "Zf";
+static char __pyx_k_20[] = "Zd";
+static char __pyx_k_21[] = "Zg";
+static char __pyx_k_22[] = "O";
+static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_24[] = "^";
+static PyObject *__pyx_kp_25;
+static PyObject *__pyx_kp_28;
+static PyObject *__pyx_kp_29;
+static PyObject *__pyx_kp_30;
+static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_26[] = ">";
+static char __pyx_k_27[] = "<";
+static char __pyx_k_28[] = "Non-native byte order not supported";
+static char __pyx_k_29[] = "Format string allocated too short.";
+static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)";
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":61
+ * VERSION = 0
+ * 
+ * def array_tree_dict_from_wiggle_reader( bx.arrays.wiggle.IntervalReader reader, sizes, default_size=2147483647, block_size=1000 ):             # <<<<<<<<<<<<<<
+ *     # Create empty array trees
+ *     rval = {}
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_array_tree_dict_from_wiggle_reader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_array_tree_dict_from_wiggle_reader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_2bx_6arrays_6wiggle_IntervalReader *__pyx_v_reader = 0;
+  PyObject *__pyx_v_sizes = 0;
+  PyObject *__pyx_v_default_size = 0;
+  PyObject *__pyx_v_block_size = 0;
+  PyObject *__pyx_v_rval;
+  PyObject *__pyx_v_last_chrom;
+  PyObject *__pyx_v_last_array_tree;
+  PyObject *__pyx_v_chrom;
+  PyObject *__pyx_v_start;
+  PyObject *__pyx_v_end;
+  PyObject *__pyx_v__;
+  PyObject *__pyx_v_val;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  PyObject *__pyx_5 = 0;
+  PyObject *__pyx_6 = 0;
+  Py_ssize_t __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_reader,&__pyx_kp_sizes,&__pyx_kp_default_size,&__pyx_kp_block_size,0};
+  __Pyx_SetupRefcountContext("array_tree_dict_from_wiggle_reader");
+  __pyx_self = __pyx_self;
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[4] = {0,0,0,0};
+    values[2] = __pyx_int_2147483647;
+    values[3] = __pyx_int_1000;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      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_reader);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_sizes);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("array_tree_dict_from_wiggle_reader", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      if (kw_args > 0) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_default_size);
+        if (unlikely(value)) { values[2] = value; kw_args--; }
+      }
+      case  3:
+      if (kw_args > 0) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_block_size);
+        if (unlikely(value)) { values[3] = value; kw_args--; }
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_tree_dict_from_wiggle_reader") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_reader = ((struct __pyx_obj_2bx_6arrays_6wiggle_IntervalReader *)values[0]);
+    __pyx_v_sizes = values[1];
+    __pyx_v_default_size = values[2];
+    __pyx_v_block_size = values[3];
+  } else {
+    __pyx_v_default_size = __pyx_int_2147483647;
+    __pyx_v_block_size = __pyx_int_1000;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  4:
+      __pyx_v_block_size = PyTuple_GET_ITEM(__pyx_args, 3);
+      case  3:
+      __pyx_v_default_size = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2:
+      __pyx_v_sizes = PyTuple_GET_ITEM(__pyx_args, 1);
+      __pyx_v_reader = ((struct __pyx_obj_2bx_6arrays_6wiggle_IntervalReader *)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("array_tree_dict_from_wiggle_reader", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.array_tree_dict_from_wiggle_reader");
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_v_rval = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_last_chrom = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_last_array_tree = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_chrom = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_start = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_end = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v__ = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_val = Py_None; __Pyx_INCREF(Py_None);
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reader), __pyx_ptype_2bx_6arrays_6wiggle_IntervalReader, 1, "reader", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":63
+ * def array_tree_dict_from_wiggle_reader( bx.arrays.wiggle.IntervalReader reader, sizes, default_size=2147483647, block_size=1000 ):
+ *     # Create empty array trees
+ *     rval = {}             # <<<<<<<<<<<<<<
+ *     ## for key, size in sizes.iteritems():
+ *     ##    rval[ key ] = ArrayTree( size, 1000 )
+ */
+  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_1));
+  __Pyx_DECREF(__pyx_v_rval);
+  __pyx_v_rval = ((PyObject *)__pyx_1);
+  __pyx_1 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":67
+ *     ##    rval[ key ] = ArrayTree( size, 1000 )
+ *     # Fill
+ *     last_chrom = None             # <<<<<<<<<<<<<<
+ *     last_array_tree = None
+ *     for chrom, start, end, _, val in reader:
+ */
+  __Pyx_INCREF(Py_None);
+  __Pyx_DECREF(__pyx_v_last_chrom);
+  __pyx_v_last_chrom = Py_None;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":68
+ *     # Fill
+ *     last_chrom = None
+ *     last_array_tree = None             # <<<<<<<<<<<<<<
+ *     for chrom, start, end, _, val in reader:
+ *         if chrom != last_chrom:
+ */
+  __Pyx_INCREF(Py_None);
+  __Pyx_DECREF(__pyx_v_last_array_tree);
+  __pyx_v_last_array_tree = Py_None;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":69
+ *     last_chrom = None
+ *     last_array_tree = None
+ *     for chrom, start, end, _, val in reader:             # <<<<<<<<<<<<<<
+ *         if chrom != last_chrom:
+ *             if chrom not in rval:
+ */
+  if (PyList_CheckExact(((PyObject *)__pyx_v_reader)) || PyTuple_CheckExact(((PyObject *)__pyx_v_reader))) {
+    __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_reader); __Pyx_INCREF(__pyx_t_2);
+  } else {
+    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_reader)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+  }
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
+    } else {
+      __pyx_t_3 = PyIter_Next(__pyx_t_2);
+      if (!__pyx_t_3) {
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_3);
+    }
+    if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 5)) {
+      PyObject* tuple = __pyx_t_3;
+      __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2);
+      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
+      __pyx_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_4);
+      __pyx_5 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_5);
+      __pyx_6 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_6);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_v_chrom);
+      __pyx_v_chrom = __pyx_2;
+      __pyx_2 = 0;
+      __Pyx_DECREF(__pyx_v_start);
+      __pyx_v_start = __pyx_3;
+      __pyx_3 = 0;
+      __Pyx_DECREF(__pyx_v_end);
+      __pyx_v_end = __pyx_4;
+      __pyx_4 = 0;
+      __Pyx_DECREF(__pyx_v__);
+      __pyx_v__ = __pyx_5;
+      __pyx_5 = 0;
+      __Pyx_DECREF(__pyx_v_val);
+      __pyx_v_val = __pyx_6;
+      __pyx_6 = 0;
+    } else {
+      __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_1);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_2);
+      __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_3);
+      __pyx_4 = __Pyx_UnpackItem(__pyx_1, 2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_4);
+      __pyx_5 = __Pyx_UnpackItem(__pyx_1, 3); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_5);
+      __pyx_6 = __Pyx_UnpackItem(__pyx_1, 4); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_6);
+      if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+      __Pyx_DECREF(__pyx_v_chrom);
+      __pyx_v_chrom = __pyx_2;
+      __pyx_2 = 0;
+      __Pyx_DECREF(__pyx_v_start);
+      __pyx_v_start = __pyx_3;
+      __pyx_3 = 0;
+      __Pyx_DECREF(__pyx_v_end);
+      __pyx_v_end = __pyx_4;
+      __pyx_4 = 0;
+      __Pyx_DECREF(__pyx_v__);
+      __pyx_v__ = __pyx_5;
+      __pyx_5 = 0;
+      __Pyx_DECREF(__pyx_v_val);
+      __pyx_v_val = __pyx_6;
+      __pyx_6 = 0;
+    }
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":70
+ *     last_array_tree = None
+ *     for chrom, start, end, _, val in reader:
+ *         if chrom != last_chrom:             # <<<<<<<<<<<<<<
+ *             if chrom not in rval:
+ *                 rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size )
+ */
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_chrom, __pyx_v_last_chrom, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    if (__pyx_t_4) {
+
+      /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":71
+ *     for chrom, start, end, _, val in reader:
+ *         if chrom != last_chrom:
+ *             if chrom not in rval:             # <<<<<<<<<<<<<<
+ *                 rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size )
+ *             last_array_tree = rval[chrom]
+ */
+      __pyx_t_4 = (!PySequence_Contains(__pyx_v_rval, __pyx_v_chrom)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__pyx_t_4) {
+
+        /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":72
+ *         if chrom != last_chrom:
+ *             if chrom not in rval:
+ *                 rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size )             # <<<<<<<<<<<<<<
+ *             last_array_tree = rval[chrom]
+ *         last_array_tree.set_range( start, end, val )
+ */
+        __pyx_t_3 = PyObject_GetAttr(__pyx_v_sizes, __pyx_kp_get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+        __Pyx_INCREF(__pyx_v_chrom);
+        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom);
+        __Pyx_GIVEREF(__pyx_v_chrom);
+        __Pyx_INCREF(__pyx_v_default_size);
+        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_default_size);
+        __Pyx_GIVEREF(__pyx_v_default_size);
+        __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
+        __Pyx_GIVEREF(__pyx_t_6);
+        __Pyx_INCREF(__pyx_v_block_size);
+        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_block_size);
+        __Pyx_GIVEREF(__pyx_v_block_size);
+        __pyx_t_6 = 0;
+        __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+        if (PyObject_SetItem(__pyx_v_rval, __pyx_v_chrom, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        goto __pyx_L9;
+      }
+      __pyx_L9:;
+
+      /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":73
+ *             if chrom not in rval:
+ *                 rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size )
+ *             last_array_tree = rval[chrom]             # <<<<<<<<<<<<<<
+ *         last_array_tree.set_range( start, end, val )
+ *     return rval
+ */
+      __pyx_1 = PyObject_GetItem(__pyx_v_rval, __pyx_v_chrom); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_1);
+      __Pyx_DECREF(__pyx_v_last_array_tree);
+      __pyx_v_last_array_tree = __pyx_1;
+      __pyx_1 = 0;
+      goto __pyx_L8;
+    }
+    __pyx_L8:;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":74
+ *                 rval[chrom] = ArrayTree( sizes.get( chrom, default_size ), block_size )
+ *             last_array_tree = rval[chrom]
+ *         last_array_tree.set_range( start, end, val )             # <<<<<<<<<<<<<<
+ *     return rval
+ * 
+ */
+    __pyx_t_6 = PyObject_GetAttr(__pyx_v_last_array_tree, __pyx_kp_set_range); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __Pyx_INCREF(__pyx_v_start);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_start);
+    __Pyx_GIVEREF(__pyx_v_start);
+    __Pyx_INCREF(__pyx_v_end);
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_end);
+    __Pyx_GIVEREF(__pyx_v_end);
+    __Pyx_INCREF(__pyx_v_val);
+    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_val);
+    __Pyx_GIVEREF(__pyx_v_val);
+    __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(__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":75
+ *             last_array_tree = rval[chrom]
+ *         last_array_tree.set_range( start, end, val )
+ *     return rval             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(__pyx_v_rval);
+  __pyx_r = __pyx_v_rval;
+  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_4);
+  __Pyx_XDECREF(__pyx_5);
+  __Pyx_XDECREF(__pyx_6);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_AddTraceback("bx.arrays.array_tree.array_tree_dict_from_wiggle_reader");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_rval);
+  __Pyx_DECREF(__pyx_v_last_chrom);
+  __Pyx_DECREF(__pyx_v_last_array_tree);
+  __Pyx_DECREF(__pyx_v_chrom);
+  __Pyx_DECREF(__pyx_v_start);
+  __Pyx_DECREF(__pyx_v_end);
+  __Pyx_DECREF(__pyx_v__);
+  __Pyx_DECREF(__pyx_v_val);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":84
  *     cdef object io
  *     cdef object cdb_dict
  *     def __init__( self, file ):             # <<<<<<<<<<<<<<
       else goto __pyx_L5_argtuple_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 = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_file = values[0];
   } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__init__");
   return -1;
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_io = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":66
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":85
  *     cdef object cdb_dict
  *     def __init__( self, file ):
  *         self.io = io = BinaryFileReader( file, MAGIC )             # <<<<<<<<<<<<<<
  *         assert io.read_uint32() == VERSION
  *         self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian )
  */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileReader); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileReader); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_1);
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_2);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_2);
   __Pyx_GIVEREF(__pyx_2);
   __pyx_2 = 0;
-  __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __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_v_io = __pyx_t_2;
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":67
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":86
  *     def __init__( self, file ):
  *         self.io = io = BinaryFileReader( file, MAGIC )
  *         assert io.read_uint32() == VERSION             # <<<<<<<<<<<<<<
  *     def __getitem__( self, key ):
  */
   #ifndef PYREX_WITHOUT_ASSERTIONS
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_43); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_2);
-  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_2, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  }
-  #endif
-
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":68
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":87
  *         self.io = io = BinaryFileReader( file, MAGIC )
  *         assert io.read_uint32() == VERSION
  *         self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian )             # <<<<<<<<<<<<<<
  *     def __getitem__( self, key ):
  *         offset = self.cdb_dict[key]
  */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_1);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file);
   __Pyx_GIVEREF(__pyx_v_file);
-  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_2));
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_is_little_endian); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_is_little_endian); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   return __pyx_r;
 }
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":69
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":88
  *         assert io.read_uint32() == VERSION
  *         self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian )
  *     def __getitem__( self, key ):             # <<<<<<<<<<<<<<
   __Pyx_SetupRefcountContext("__getitem__");
   __pyx_v_offset = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":70
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":89
  *         self.cdb_dict = FileCDBDict( file, is_little_endian=io.is_little_endian )
  *     def __getitem__( self, key ):
  *         offset = self.cdb_dict[key]             # <<<<<<<<<<<<<<
  *         offset = self.io.unpack( "L", offset )[0]
  *         self.io.seek( offset )
  */
-  __pyx_1 = PyObject_GetItem(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = PyObject_GetItem(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict, __pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_1);
   __Pyx_DECREF(__pyx_v_offset);
   __pyx_v_offset = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":71
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":90
  *     def __getitem__( self, key ):
  *         offset = self.cdb_dict[key]
  *         offset = self.io.unpack( "L", offset )[0]             # <<<<<<<<<<<<<<
  *         self.io.seek( offset )
  *         return FileArrayTree( self.io.file, self.io.is_little_endian )
  */
-  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-  __Pyx_INCREF(__pyx_kp_35);
-  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_35);
-  __Pyx_GIVEREF(__pyx_kp_35);
+  __Pyx_INCREF(__pyx_kp_44);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_44);
+  __Pyx_GIVEREF(__pyx_kp_44);
   __Pyx_INCREF(__pyx_v_offset);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_offset);
   __Pyx_GIVEREF(__pyx_v_offset);
-  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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_2)); __pyx_t_2 = 0;
-  __pyx_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
   __Pyx_DECREF(__pyx_v_offset);
   __pyx_v_offset = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":72
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":91
  *         offset = self.cdb_dict[key]
  *         offset = self.io.unpack( "L", offset )[0]
  *         self.io.seek( offset )             # <<<<<<<<<<<<<<
  *         return FileArrayTree( self.io.file, self.io.is_little_endian )
  * 
  */
-  __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_offset);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_offset);
   __Pyx_GIVEREF(__pyx_v_offset);
-  __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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 91; __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":73
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":92
  *         offset = self.io.unpack( "L", offset )[0]
  *         self.io.seek( offset )
  *         return FileArrayTree( self.io.file, self.io.is_little_endian )             # <<<<<<<<<<<<<<
  *     @classmethod
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_is_little_endian); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io, __pyx_kp_is_little_endian); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
   __pyx_r = __pyx_t_2;
   return __pyx_r;
 }
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":76
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":95
  * 
  *     @classmethod
  *     def dict_to_file( Class, dict, file, is_little_endian=True ):             # <<<<<<<<<<<<<<
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
-    values[2] = __pyx_k_28;
+    values[2] = __pyx_k_37;
     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);
       values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_file);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
       case  2:
       if (kw_args > 1) {
       }
     }
     if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dict_to_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dict_to_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_dict = values[0];
     __pyx_v_file = values[1];
     __pyx_v_is_little_endian = values[2];
   } else {
-    __pyx_v_is_little_endian = __pyx_k_28;
+    __pyx_v_is_little_endian = __pyx_k_37;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
       __pyx_v_is_little_endian = PyTuple_GET_ITEM(__pyx_args, 2);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("dict_to_file", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.dict_to_file");
   return NULL;
   __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
   __pyx_v_offset = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":81
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
  *         read efficiently using this class.
  *         """
  *         io = BinaryFileWriter( file, is_little_endian=is_little_endian )             # <<<<<<<<<<<<<<
  *         # Write magic number and version
  *         io.write_uint32( MAGIC )
  */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileWriter); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileWriter); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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_file);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file);
   __Pyx_GIVEREF(__pyx_v_file);
-  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_2));
-  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 100; __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_v_io = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":83
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":102
  *         io = BinaryFileWriter( file, is_little_endian=is_little_endian )
  *         # Write magic number and version
  *         io.write_uint32( MAGIC )             # <<<<<<<<<<<<<<
  *         io.write_uint32( VERSION )
  *         # Write cdb index with fake values just to fill space
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_36); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_45); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_MAGIC); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1);
   __Pyx_GIVEREF(__pyx_1);
   __pyx_1 = 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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 102; __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":84
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":103
  *         # Write magic number and version
  *         io.write_uint32( MAGIC )
  *         io.write_uint32( VERSION )             # <<<<<<<<<<<<<<
  *         # Write cdb index with fake values just to fill space
  *         cdb_dict = {}
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_36); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_45); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_2);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_2);
   __Pyx_GIVEREF(__pyx_2);
   __pyx_2 = 0;
-  __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 103; __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":86
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":105
  *         io.write_uint32( VERSION )
  *         # Write cdb index with fake values just to fill space
  *         cdb_dict = {}             # <<<<<<<<<<<<<<
  *         for key in dict.iterkeys():
  *             cdb_dict[ key ] = io.pack( "L", 0 )
  */
-  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_1));
   __Pyx_DECREF(__pyx_v_cdb_dict);
   __pyx_v_cdb_dict = ((PyObject *)__pyx_1);
   __pyx_1 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":87
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":106
  *         # Write cdb index with fake values just to fill space
  *         cdb_dict = {}
  *         for key in dict.iterkeys():             # <<<<<<<<<<<<<<
  *             cdb_dict[ key ] = io.pack( "L", 0 )
  *         cdb_offset = io.tell()
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_dict, __pyx_kp_iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_dict, __pyx_kp_iterkeys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
     __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
   } else {
-    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
   }
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     } else {
       __pyx_t_1 = PyIter_Next(__pyx_t_2);
       if (!__pyx_t_1) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_1);
     __pyx_v_key = __pyx_t_1;
     __pyx_t_1 = 0;
 
-    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":88
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":107
  *         cdb_dict = {}
  *         for key in dict.iterkeys():
  *             cdb_dict[ key ] = io.pack( "L", 0 )             # <<<<<<<<<<<<<<
  *         cdb_offset = io.tell()
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_3));
-    __Pyx_INCREF(__pyx_kp_37);
-    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_37);
-    __Pyx_GIVEREF(__pyx_kp_37);
+    __Pyx_INCREF(__pyx_kp_46);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_46);
+    __Pyx_GIVEREF(__pyx_kp_46);
     __Pyx_INCREF(__pyx_int_0);
     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
     __Pyx_GIVEREF(__pyx_int_0);
-    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-    if (PyObject_SetItem(__pyx_v_cdb_dict, __pyx_v_key, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetItem(__pyx_v_cdb_dict, __pyx_v_key, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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":89
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":108
  *         for key in dict.iterkeys():
  *             cdb_dict[ key ] = io.pack( "L", 0 )
  *         cdb_offset = io.tell()             # <<<<<<<<<<<<<<
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  *         # Write each tree and save offset
  */
-  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_tell); 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_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   __Pyx_DECREF(__pyx_v_cdb_offset);
   __pyx_v_cdb_offset = __pyx_t_5;
   __pyx_t_5 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":90
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":109
  *             cdb_dict[ key ] = io.pack( "L", 0 )
  *         cdb_offset = io.tell()
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )             # <<<<<<<<<<<<<<
  *         # Write each tree and save offset
  *         for key, value in dict.iteritems():
  */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_2);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_to_file); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_to_file); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_v_cdb_dict);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cdb_dict);
   __Pyx_INCREF(__pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_file);
   __Pyx_GIVEREF(__pyx_v_file);
-  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_1));
-  if (PyDict_SetItem(__pyx_1, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_1, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __Pyx_DECREF(((PyObject *)__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":92
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":111
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  *         # Write each tree and save offset
  *         for key, value in dict.iteritems():             # <<<<<<<<<<<<<<
  *             offset = io.tell()
  *             cdb_dict[ key ] = io.pack( "L", offset )
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dict, __pyx_kp_iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_dict, __pyx_kp_iteritems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), 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_3); __pyx_t_3 = 0;
   if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
     __pyx_t_4 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
   } else {
-    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
   }
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     } else {
       __pyx_t_2 = PyIter_Next(__pyx_t_3);
       if (!__pyx_t_2) {
-        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         break;
       }
       __Pyx_GOTREF(__pyx_t_2);
       __pyx_v_value = __pyx_3;
       __pyx_3 = 0;
     } else {
-      __pyx_2 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_2 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_2);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __pyx_1 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_1 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_1);
-      __pyx_3 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_3 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_3);
-      if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_DECREF(__pyx_2); __pyx_2 = 0;
       __Pyx_DECREF(__pyx_v_key);
       __pyx_v_key = __pyx_1;
       __pyx_3 = 0;
     }
 
-    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":93
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":112
  *         # Write each tree and save offset
  *         for key, value in dict.iteritems():
  *             offset = io.tell()             # <<<<<<<<<<<<<<
  *             cdb_dict[ key ] = io.pack( "L", offset )
  *             value.to_file( file, is_little_endian=is_little_endian )
  */
-    __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
     __Pyx_DECREF(__pyx_v_offset);
     __pyx_v_offset = __pyx_t_5;
     __pyx_t_5 = 0;
 
-    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":94
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":113
  *         for key, value in dict.iteritems():
  *             offset = io.tell()
  *             cdb_dict[ key ] = io.pack( "L", offset )             # <<<<<<<<<<<<<<
  *             value.to_file( file, is_little_endian=is_little_endian )
  *         # Go back and write the index again
  */
-    __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_pack); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_pack); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
-    __Pyx_INCREF(__pyx_kp_38);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_38);
-    __Pyx_GIVEREF(__pyx_kp_38);
+    __Pyx_INCREF(__pyx_kp_47);
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_47);
+    __Pyx_GIVEREF(__pyx_kp_47);
     __Pyx_INCREF(__pyx_v_offset);
     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_offset);
     __Pyx_GIVEREF(__pyx_v_offset);
-    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
-    if (PyObject_SetItem(__pyx_v_cdb_dict, __pyx_v_key, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetItem(__pyx_v_cdb_dict, __pyx_v_key, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 
-    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":95
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":114
  *             offset = io.tell()
  *             cdb_dict[ key ] = io.pack( "L", offset )
  *             value.to_file( file, is_little_endian=is_little_endian )             # <<<<<<<<<<<<<<
  *         # Go back and write the index again
  *         io.seek( cdb_offset )
  */
-    __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_kp_to_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_kp_to_file); 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 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_2));
     __Pyx_INCREF(__pyx_v_file);
     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file);
     __Pyx_GIVEREF(__pyx_v_file);
-    __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_2));
-    if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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":97
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":116
  *             value.to_file( file, is_little_endian=is_little_endian )
  *         # Go back and write the index again
  *         io.seek( cdb_offset )             # <<<<<<<<<<<<<<
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
  * 
  */
-  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_GetAttr(__pyx_v_io, __pyx_kp_seek); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(__pyx_v_cdb_offset);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_cdb_offset);
   __Pyx_GIVEREF(__pyx_v_cdb_offset);
-  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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_5)); __pyx_t_5 = 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":98
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":117
  *         # Go back and write the index again
  *         io.seek( cdb_offset )
  *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )             # <<<<<<<<<<<<<<
  * 
  * cdef class FileArrayTree:
  */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_FileCDBDict); 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_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_to_file); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_to_file); 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_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(__pyx_v_cdb_dict);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_cdb_dict);
   __Pyx_INCREF(__pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_file);
   __Pyx_GIVEREF(__pyx_v_file);
-  __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_3));
-  if (PyDict_SetItem(__pyx_3, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_3, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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_5)); __pyx_t_5 = 0;
   return __pyx_r;
 }
 
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":111
- *     cdef int root_offset
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":131
  *     cdef object io
+ * 
  *     def __init__( self, file, is_little_endian=True ):             # <<<<<<<<<<<<<<
  *         self.io = BinaryFileReader( file, is_little_endian=is_little_endian )
  *         self.offset = self.io.tell()
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[2] = {0,0};
-    values[1] = __pyx_k_29;
+    values[1] = __pyx_k_38;
     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);
       }
     }
     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 = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     }
     __pyx_v_file = values[0];
     __pyx_v_is_little_endian = values[1];
   } else {
-    __pyx_v_is_little_endian = __pyx_k_29;
+    __pyx_v_is_little_endian = __pyx_k_38;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  2: __pyx_v_is_little_endian = PyTuple_GET_ITEM(__pyx_args, 1);
       case  1: __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__init__");
   return -1;
   __pyx_L4_argument_unpacking_done:;
   __pyx_v_dt = Py_None; __Pyx_INCREF(Py_None);
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":112
- *     cdef object io
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":132
+ * 
  *     def __init__( self, file, is_little_endian=True ):
  *         self.io = BinaryFileReader( file, is_little_endian=is_little_endian )             # <<<<<<<<<<<<<<
  *         self.offset = self.io.tell()
  *         # Read basic info about the tree
  */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileReader); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_BinaryFileReader); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_file);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_file);
   __Pyx_GIVEREF(__pyx_v_file);
-  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_2));
-  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_2, __pyx_kp_is_little_endian, __pyx_v_is_little_endian) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 132; __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;
   ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":113
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":133
  *     def __init__( self, file, is_little_endian=True ):
  *         self.io = BinaryFileReader( file, is_little_endian=is_little_endian )
  *         self.offset = self.io.tell()             # <<<<<<<<<<<<<<
  *         # Read basic info about the tree
  *         self.max = self.io.read_uint32()
  */
-  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_tell); 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 = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->offset = __pyx_t_3;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":115
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":135
  *         self.offset = self.io.tell()
  *         # Read basic info about the tree
  *         self.max = self.io.read_uint32()             # <<<<<<<<<<<<<<
  *         self.block_size = self.io.read_uint32()
  *         # Read dtype and canonicalize
  */
-  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_43); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
   ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max = __pyx_t_3;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":116
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":136
  *         # Read basic info about the tree
  *         self.max = self.io.read_uint32()
  *         self.block_size = self.io.read_uint32()             # <<<<<<<<<<<<<<
  *         # Read dtype and canonicalize
  *         dt = self.io.read( 1 )
  */
-  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_43); 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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size = __pyx_t_3;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":118
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":138
  *         self.block_size = self.io.read_uint32()
  *         # Read dtype and canonicalize
  *         dt = self.io.read( 1 )             # <<<<<<<<<<<<<<
  *         self.dtype = numpy.dtype( dt )
  *         self.io.skip( 3 )
  */
-  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_read); 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 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_INCREF(__pyx_int_1);
   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
   __Pyx_GIVEREF(__pyx_int_1);
-  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), 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_1); __pyx_t_1 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
   __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":119
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":139
  *         # Read dtype and canonicalize
  *         dt = self.io.read( 1 )
  *         self.dtype = numpy.dtype( dt )             # <<<<<<<<<<<<<<
  *         self.io.skip( 3 )
  *         # How many levels are needed to cover the entire range?