Commits

James Taylor committed 79148d2

ArrayTree now supports more than one aray per file (using CDB). Also, some minor documentation work

Comments (0)

Files changed (11)

doc/source/conf.py

 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.
-html_additional_pages = {
-    'index': 'index.html',
-}
+##html_additional_pages = {
+##    'index': 'index.html',
+##}
 
 # If false, no module index is generated.
 #html_use_modindex = True

doc/source/contents.rst

 Contents:
 
 .. toctree::
-    :maxdepth: 3
+   :maxdepth: 2
+
+   modules/index.rst 
 
 * :ref:`genindex`
 * :ref:`modindex`

doc/source/index.rst

-.. BxPython documentation master file, created by sphinx-quickstart on Fri May 08 10:18:22 2009.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
+About bx-python
+===============
 
-Welcome to bx-python's documentation
-====================================
+The bx-python project is a python library and associated set of scripts to allow for rapid implementation of genome scale analyses. The library contains a variety of useful modules, but the particular strengths are:
 
-Contents:
+ * Classes for reading and working with genome-scale multiple local alignments (in MAF, AXT, and LAV formats)
+ * Generic data structure for indexing on disk files that contain blocks of data associated with intervals on various sequences (used, for example, to provide random access to individual alignments in huge files; optomized for use over network filesystems)
+ * Data structures for working with intervals on sequences
+ * "Binned bitsets" which act just like chromosome sized bit arrays, but lazily allocate regions and allow large blocks of all set or all unset bits to be stored compactly
+ * "Intersecter" for performing fast intersection tests that preserve both query and target intervals and associated annotation 
+
+These tools have been used in a variety of published research, and are a fundamental part of the ongoing Galaxy and ESPERR projects.
+
+Contents
+========
 
 .. toctree::
    :maxdepth: 2
 
+   modules/index.rst
+
 Indices and tables
 ==================
 

doc/source/templates/index.html

     
   </p>
 
-  <p> 
-    Browse the Python <a href="apidoc/index.html">API documentation</a>
-  </p>
+  <h1>Documentation</h1>
+
+  <ul>
+    <li><a href="{{ pathto("contents") }}">Contents</a></li>
+    <li><a href="{{ pathto("search") }}">Search</a></li>
+    <li><a href="{{ pathto("genindex") }}">General Index</a></li>
+    <li><a href="{{ pathto("modindex") }}">Module Index</a></li>
+    <li><a href="apidoc/index.html">API documentation</a></li>
+  </ul>
 
 {% endblock %}

lib/bx/arrays/array_tree.c

-/* Generated by Cython 0.11.1 on Fri May 29 15:38:40 2009 */
+/* Generated by Cython 0.11.1 on Wed Aug 12 14:23:03 2009 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
 #define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
 
-static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
-
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name, PyObject* kw_name); /*proto*/
 
 
 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
 
-#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
-                                                    __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
-                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
-
-static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
-    int r;
-    if (!j) return -1;
-    r = PyObject_SetItem(o, j, v);
-    Py_DECREF(j);
-    return r;
-}
-
-static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
-    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
-        Py_INCREF(v);
-        Py_DECREF(PyList_GET_ITEM(o, i));
-        PyList_SET_ITEM(o, i, v);
-        return 1;
-    }
-    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
-        return PySequence_SetItem(o, i, v);
-    else {
-        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
-        return __Pyx_SetItemInt_Generic(o, j, v);
-    }
-}
-
 
 static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
     PyObject *r;
     return r;
 }
 
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \
+                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
+
+static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
+    int r;
+    if (!j) return -1;
+    r = PyObject_SetItem(o, j, v);
+    Py_DECREF(j);
+    return r;
+}
+
+static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) {
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        Py_INCREF(v);
+        Py_DECREF(PyList_GET_ITEM(o, i));
+        PyList_SET_ITEM(o, i, v);
+        return 1;
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0)))
+        return PySequence_SetItem(o, i, v);
+    else {
+        PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i);
+        return __Pyx_SetItemInt_Generic(o, j, v);
+    }
+}
+
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
     const char *name, int exact); /*proto*/
 
 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
 #include "descrobject.h"
 static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
 
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static INLINE void __Pyx_RaiseTooManyValuesError(void);
+
+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 int __Pyx_pow_int(int, int); /* proto */
 
 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
 
-/* "/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":149
+ *             return self.io.read_raw_array( self.dtype, 1 )[0]
+ * 
+ * cdef class Summary:             # <<<<<<<<<<<<<<
+ *     """
+ *     Summary for a non-leaf level of the tree, contains arrays of the min, max,
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_Summary {
+  PyObject_HEAD
+  PyObject *counts;
+  PyObject *mins;
+  PyObject *maxs;
+  PyObject *sums;
+  PyObject *sumsquares;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":161
+ * 
+ * cdef class ArrayTreeNode
+ * cdef class ArrayTreeLeaf             # <<<<<<<<<<<<<<
+ * 
+ * cdef class ArrayTree:
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf {
+  PyObject_HEAD
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree;
+  int min;
+  int max;
+  PyArrayObject *values;
+  long start_offset;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
+ *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
+ * 
+ * cdef class FileArrayTree:             # <<<<<<<<<<<<<<
+ *     """
+ *     Wrapper for ArrayTree stored in file that reads as little as possible
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *__pyx_vtab;
+  int max;
+  int block_size;
+  PyObject *dtype;
+  int levels;
+  int offset;
+  int root_offset;
+  PyObject *io;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":163
+ * cdef class ArrayTreeLeaf
+ * 
+ * cdef class ArrayTree:             # <<<<<<<<<<<<<<
+ *     """
+ *     Stores a sparse array of data as a tree.
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree {
+  PyObject_HEAD
+  int max;
+  int block_size;
+  PyObject *dtype;
+  int levels;
+  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *root;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":59
+ * VERSION = 0
+ * 
+ * cdef class FileArrayTreeDict:             # <<<<<<<<<<<<<<
+ *     """
+ *     Access to a file containing multiple array trees indexed by a string key.
+ */
+
+struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict {
+  PyObject_HEAD
+  PyObject *io;
+  PyObject *cdb_dict;
+};
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":160
  *     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":58
- * VERSION = 0
- * 
- * cdef class Summary( object ):             # <<<<<<<<<<<<<<
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":100
+ *         FileCDBDict.to_file( cdb_dict, file, is_little_endian=is_little_endian )
+ * 
+ * cdef class FileArrayTree:             # <<<<<<<<<<<<<<
  *     """
- *     Summary for a non-leaf level of the tree, contains arrays of the min, max,
- */
-
-struct __pyx_obj_2bx_6arrays_10array_tree_Summary {
-  PyObject_HEAD
-  PyObject *counts;
-  PyObject *mins;
-  PyObject *maxs;
-  PyObject *sums;
-  PyObject *sumsquares;
+ *     Wrapper for ArrayTree stored in file that reads as little as possible
+ */
+
+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);
 };
-
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":72
- * cdef class ArrayTreeLeaf
- * 
- * cdef class ArrayTree:             # <<<<<<<<<<<<<<
- *     """
- *     Stores a sparse array of data as a tree.
- */
-
-struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree {
-  PyObject_HEAD
-  int max;
-  int block_size;
-  PyObject *dtype;
-  int levels;
-  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeNode *root;
-};
-
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":70
- * 
- * cdef class ArrayTreeNode
- * cdef class ArrayTreeLeaf             # <<<<<<<<<<<<<<
- * 
- * cdef class ArrayTree:
- */
-
-struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTreeLeaf {
-  PyObject_HEAD
-  struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *tree;
-  int min;
-  int max;
-  PyArrayObject *values;
-  long start_offset;
-};
-
-
-/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":158
+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
  *         return tree
  * 
  * cdef class ArrayTreeNode:             # <<<<<<<<<<<<<<
 static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *); /*proto*/
 /* Module declarations from bx.arrays.array_tree */
 
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTreeDict = 0;
+static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_FileArrayTree = 0;
 static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_Summary = 0;
 static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode = 0;
 static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeLeaf = 0;
 static PyTypeObject *__pyx_ptype_2bx_6arrays_10array_tree_ArrayTree = 0;
-static PyObject *__pyx_k_27 = 0;
+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_int_0x310ec7dc;
 static PyObject *__pyx_int_0;
 static PyObject *__pyx_int_1000;
-static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_3;
+static PyObject *__pyx_int_5;
+static PyObject *__pyx_int_neg_1;
 static PyObject *__pyx_int_2;
-static PyObject *__pyx_int_5;
 static char __pyx_k___init__[] = "__init__";
 static PyObject *__pyx_kp___init__;
+static char __pyx_k___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___setitem__[] = "__setitem__";
 static PyObject *__pyx_kp___setitem__;
 static char __pyx_k_set_range[] = "set_range";
 static PyObject *__pyx_kp_set_range;
-static char __pyx_k___getitem__[] = "__getitem__";
-static PyObject *__pyx_kp___getitem__;
 static char __pyx_k_to_file[] = "to_file";
 static PyObject *__pyx_kp_to_file;
 static char __pyx_k_from_file[] = "from_file";
 static PyObject *__pyx_kp_to_file_data_pass;
 static char __pyx_k_to_file_offset_pass[] = "to_file_offset_pass";
 static PyObject *__pyx_kp_to_file_offset_pass;
+static char __pyx_k_get_from_file[] = "get_from_file";
+static PyObject *__pyx_kp_get_from_file;
+static char __pyx_k_file[] = "file";
+static PyObject *__pyx_kp_file;
+static char __pyx_k_key[] = "key";
+static PyObject *__pyx_kp_key;
+static char __pyx_k_dict[] = "dict";
+static PyObject *__pyx_kp_dict;
+static char __pyx_k_is_little_endian[] = "is_little_endian";
+static PyObject *__pyx_kp_is_little_endian;
+static char __pyx_k_index[] = "index";
+static PyObject *__pyx_kp_index;
 static char __pyx_k_value[] = "value";
 static PyObject *__pyx_kp_value;
 static char __pyx_k_max[] = "max";
 static PyObject *__pyx_kp_block_size;
 static char __pyx_k_dtype[] = "dtype";
 static PyObject *__pyx_kp_dtype;
-static char __pyx_k_index[] = "index";
-static PyObject *__pyx_kp_index;
 static char __pyx_k_start[] = "start";
 static PyObject *__pyx_kp_start;
 static char __pyx_k_end[] = "end";
 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___all__[] = "__all__";
 static PyObject *__pyx_kp___all__;
 static char __pyx_k_numpy[] = "numpy";
 static PyObject *__pyx_kp_numpy;
-static char __pyx_k_24[] = "*";
-static PyObject *__pyx_kp_24;
-static char __pyx_k_25[] = "bx.misc.binary_file";
+static 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_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_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_26[] = "float32";
-static PyObject *__pyx_kp_26;
+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_unpack[] = "unpack";
+static PyObject *__pyx_kp_unpack;
+static char __pyx_k_35[] = "L";
+static PyObject *__pyx_kp_35;
+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_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_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_read[] = "read";
+static PyObject *__pyx_kp_read;
+static char __pyx_k_skip[] = "skip";
+static PyObject *__pyx_kp_skip;
+static char __pyx_k_itemsize[] = "itemsize";
+static PyObject *__pyx_kp_itemsize;
+static char __pyx_k_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_magic[] = "magic";
-static PyObject *__pyx_kp_magic;
-static char __pyx_k_29[] = "write_uint32";
-static PyObject *__pyx_kp_29;
 static char __pyx_k_write[] = "write";
 static PyObject *__pyx_kp_write;
 static char __pyx_k_char[] = "char";
 static PyObject *__pyx_kp_char;
-static char __pyx_k_31[] = "read_uint32";
-static PyObject *__pyx_kp_31;
-static char __pyx_k_read[] = "read";
-static PyObject *__pyx_kp_read;
 static char __pyx_k_root[] = "root";
 static PyObject *__pyx_kp_root;
 static char __pyx_k_nan[] = "nan";
 static PyObject *__pyx_kp_sums;
 static char __pyx_k_sumsquares[] = "sumsquares";
 static PyObject *__pyx_kp_sumsquares;
-static char __pyx_k_tell[] = "tell";
-static PyObject *__pyx_kp_tell;
 static char __pyx_k_write_raw_array[] = "write_raw_array";
 static PyObject *__pyx_kp_write_raw_array;
-static char __pyx_k_skip[] = "skip";
-static PyObject *__pyx_kp_skip;
-static char __pyx_k_itemsize[] = "itemsize";
-static PyObject *__pyx_kp_itemsize;
-static char __pyx_k_seek[] = "seek";
-static PyObject *__pyx_kp_seek;
-static char __pyx_k_33[] = "write_uint64";
-static PyObject *__pyx_kp_33;
+static char __pyx_k_44[] = "write_uint64";
+static PyObject *__pyx_kp_44;
 static char __pyx_k_start_offset[] = "start_offset";
 static PyObject *__pyx_kp_start_offset;
-static char __pyx_k_read_raw_array[] = "read_raw_array";
-static PyObject *__pyx_kp_read_raw_array;
-static char __pyx_k_34[] = "read_uint64";
-static PyObject *__pyx_kp_34;
 static PyObject *__pyx_builtin_range;
 static PyObject *__pyx_builtin_sum;
-static PyObject *__pyx_kp_28;
-static char __pyx_k_28[] = "max < block_size not yet handled";
-static PyObject *__pyx_kp_30;
-static char __pyx_k_30[] = "\000\000\000";
-static PyObject *__pyx_kp_32;
-static char __pyx_k_32[] = "Writing without summaries is currently not supported";
+static 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 char __pyx_k___getbuffer__[] = "__getbuffer__";
 static PyObject *__pyx_kp___getbuffer__;
 static char __pyx_k___releasebuffer__[] = "__releasebuffer__";
 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":92
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":65
+ *     cdef object io
+ *     cdef object cdb_dict
+ *     def __init__( self, file ):             # <<<<<<<<<<<<<<
+ *         self.io = io = BinaryFileReader( file, MAGIC )
+ *         assert io.read_uint32() == VERSION
+ */
+
+static int __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_file = 0;
+  PyObject *__pyx_v_io;
+  int __pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_file,0};
+  __Pyx_SetupRefcountContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[1] = {0};
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      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_file);
+      if (likely(values[0])) kw_args--;
+      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;}
+    }
+    __pyx_v_file = values[0];
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);
+  }
+  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_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
+ *     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_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_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_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);
+  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_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_INCREF(__pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io);
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->io = __pyx_t_2;
+  __Pyx_INCREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_v_io);
+  __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
+ *     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 )
+ *     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_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_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_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_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_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
+ *         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_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_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_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_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;}
+  __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_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict);
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTreeDict *)__pyx_v_self)->cdb_dict = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_2);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_io);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":69
+ *         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]
+ *         offset = self.io.unpack( "L", offset )[0]
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+  PyObject *__pyx_v_offset;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  __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
+ *         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_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
+ *     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_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_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_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_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_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
+ *         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_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_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_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
+ *         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_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_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_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
+  __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_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.__getitem__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_offset);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":76
+ * 
+ *     @classmethod
+ *     def dict_to_file( Class, dict, file, is_little_endian=True ):             # <<<<<<<<<<<<<<
+ *         """
+ *         Writes a dictionary of array trees to a file that can then be
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_dict_to_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_2bx_6arrays_10array_tree_17FileArrayTreeDict_dict_to_file[] = "\n        Writes a dictionary of array trees to a file that can then be\n        read efficiently using this class.\n        ";
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_17FileArrayTreeDict_dict_to_file(PyObject *__pyx_v_Class, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_dict = 0;
+  PyObject *__pyx_v_file = 0;
+  PyObject *__pyx_v_is_little_endian = 0;
+  PyObject *__pyx_v_io;
+  PyObject *__pyx_v_cdb_dict;
+  PyObject *__pyx_v_key;
+  PyObject *__pyx_v_cdb_offset;
+  PyObject *__pyx_v_value;
+  PyObject *__pyx_v_offset;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  Py_ssize_t __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_dict,&__pyx_kp_file,&__pyx_kp_is_little_endian,0};
+  __Pyx_SetupRefcountContext("dict_to_file");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[3] = {0,0,0};
+    values[2] = __pyx_k_28;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_dict);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  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;}
+      }
+      case  2:
+      if (kw_args > 1) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_is_little_endian);
+        if (unlikely(value)) { values[2] = value; kw_args--; }
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dict_to_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __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;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  3:
+      __pyx_v_is_little_endian = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2:
+      __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 1);
+      __pyx_v_dict = 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("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_L3_error:;
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.dict_to_file");
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_v_io = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_cdb_dict = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_key = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_cdb_offset = Py_None; __Pyx_INCREF(Py_None);
+  __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
+ *         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_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_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_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;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+  __Pyx_DECREF(__pyx_v_io);
+  __pyx_v_io = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":83
+ *         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_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_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_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_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
+ *         # 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_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_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_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_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
+ *         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_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
+ *         # 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_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_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_GOTREF(__pyx_t_2);
+  }
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
+    } 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;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_1);
+    }
+    __Pyx_DECREF(__pyx_v_key);
+    __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
+ *         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_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_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_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_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;}
+    __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
+ *         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_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_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
+ *             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_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_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_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_v_cdb_dict);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cdb_dict);
+  __Pyx_GIVEREF(__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_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;}
+  __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
+ *         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_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_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_GOTREF(__pyx_t_3);
+  }
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  for (;;) {
+    if (likely(PyList_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
+      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
+      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
+    } 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;}
+        break;
+      }
+      __Pyx_GOTREF(__pyx_t_2);
+    }
+    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
+      PyObject* tuple = __pyx_t_2;
+      __pyx_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_1);
+      __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __Pyx_DECREF(__pyx_v_key);
+      __pyx_v_key = __pyx_1;
+      __pyx_1 = 0;
+      __Pyx_DECREF(__pyx_v_value);
+      __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_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_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_GOTREF(__pyx_3);
+      if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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_1 = 0;
+      __Pyx_DECREF(__pyx_v_value);
+      __pyx_v_value = __pyx_3;
+      __pyx_3 = 0;
+    }
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":93
+ *         # 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_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_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
+ *         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_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_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_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_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;}
+    __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
+ *             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_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_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_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;}
+    __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(((PyObject *)__pyx_2)); __pyx_2 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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
+ *             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_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_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_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
+ *         # 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_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_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_GOTREF(((PyObject *)__pyx_t_5));
+  __Pyx_INCREF(__pyx_v_cdb_dict);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_cdb_dict);
+  __Pyx_GIVEREF(__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_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;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_2);
+  __Pyx_XDECREF(__pyx_3);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTreeDict.dict_to_file");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_io);
+  __Pyx_DECREF(__pyx_v_cdb_dict);
+  __Pyx_DECREF(__pyx_v_key);
+  __Pyx_DECREF(__pyx_v_cdb_offset);
+  __Pyx_DECREF(__pyx_v_value);
+  __Pyx_DECREF(__pyx_v_offset);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":111
+ *     cdef int root_offset
+ *     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()
+ */
+
+static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_file = 0;
+  PyObject *__pyx_v_is_little_endian = 0;
+  PyObject *__pyx_v_dt;
+  int __pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_kp_file,&__pyx_kp_is_little_endian,0};
+  __Pyx_SetupRefcountContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[2] = {0,0};
+    values[1] = __pyx_k_29;
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_file);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      if (kw_args > 1) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_is_little_endian);
+        if (unlikely(value)) { values[1] = value; kw_args--; }
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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;
+    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);
+      break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+  }
+  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_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
+ *     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_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_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_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;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_1); __pyx_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0;
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io);
+  ((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
+ *     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_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_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_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
+ *         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_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_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_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
+ *         # 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_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_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_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
+ *         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_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_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_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(__pyx_v_dt);
+  __pyx_v_dt = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":119
+ *         # 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?
+ */
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_INCREF(__pyx_v_dt);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dt);
+  __Pyx_GIVEREF(__pyx_v_dt);
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype);
+  __Pyx_DECREF(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype);
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->dtype = __pyx_t_2;
+  __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":120
+ *         dt = self.io.read( 1 )
+ *         self.dtype = numpy.dtype( dt )
+ *         self.io.skip( 3 )             # <<<<<<<<<<<<<<
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0
+ */
+  __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_INCREF(__pyx_int_3);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
+  __Pyx_GIVEREF(__pyx_int_3);
+  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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":122
+ *         self.io.skip( 3 )
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0             # <<<<<<<<<<<<<<
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:
+ *             self.levels += 1
+ */
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":123
+ *         # How many levels are needed to cover the entire range?
+ *         self.levels = 0
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:             # <<<<<<<<<<<<<<
+ *             self.levels += 1
+ *         # Not yet dealing with the case where the root is a Leaf
+ */
+  while (1) {
+    __pyx_t_5 = (__Pyx_pow_long(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->block_size, (((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels + 1)) < ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->max);
+    if (!__pyx_t_5) break;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":124
+ *         self.levels = 0
+ *         while self.block_size ** ( self.levels + 1 ) < self.max:
+ *             self.levels += 1             # <<<<<<<<<<<<<<
+ *         # Not yet dealing with the case where the root is a Leaf
+ *         assert self.levels > 0, "max < block_size not yet handled"
+ */
+    ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels += 1;
+  }
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":126
+ *             self.levels += 1
+ *         # Not yet dealing with the case where the root is a Leaf
+ *         assert self.levels > 0, "max < block_size not yet handled"             # <<<<<<<<<<<<<<
+ *         # Save offset of root
+ *         self.root_offset = self.io.tell()
+ */
+  #ifndef PYREX_WITHOUT_ASSERTIONS
+  if (unlikely(!(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels > 0))) {
+    PyErr_SetObject(PyExc_AssertionError, __pyx_kp_39);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  #endif
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":128
+ *         assert self.levels > 0, "max < block_size not yet handled"
+ *         # Save offset of root
+ *         self.root_offset = self.io.tell()             # <<<<<<<<<<<<<<
+ *     def __getitem__( self, index ):
+ *         return self.r_get_helper( index, 0, self.root_offset, self.levels )
+ */
+  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->io, __pyx_kp_tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset = __pyx_t_3;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_2);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_dt);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":129
+ *         # Save offset of root
+ *         self.root_offset = self.io.tell()
+ *     def __getitem__( self, index ):             # <<<<<<<<<<<<<<
+ *         return self.r_get_helper( index, 0, self.root_offset, self.levels )
+ *     cdef r_get_helper( self, int index, int min, long long offset, int level ):
+ */
+
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
+static PyObject *__pyx_pf_2bx_6arrays_10array_tree_13FileArrayTree___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  __Pyx_SetupRefcountContext("__getitem__");
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":130
+ *         self.root_offset = self.io.tell()
+ *     def __getitem__( self, index ):
+ *         return self.r_get_helper( index, 0, self.root_offset, self.levels )             # <<<<<<<<<<<<<<
+ *     cdef r_get_helper( self, int index, int min, long long offset, int level ):
+ *         cdef int child_size, bin_index, child_min
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_index); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->__pyx_vtab)->r_get_helper(((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self), __pyx_t_1, 0, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->root_offset, ((struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.__getitem__");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":131
+ *     def __getitem__( self, index ):
+ *         return self.r_get_helper( index, 0, self.root_offset, self.levels )
+ *     cdef r_get_helper( self, int index, int min, long long offset, int level ):             # <<<<<<<<<<<<<<
+ *         cdef int child_size, bin_index, child_min
+ *         self.io.seek( offset )
+ */
+
+static  PyObject *__pyx_f_2bx_6arrays_10array_tree_13FileArrayTree_r_get_helper(struct __pyx_obj_2bx_6arrays_10array_tree_FileArrayTree *__pyx_v_self, int __pyx_v_index, int __pyx_v_min, PY_LONG_LONG __pyx_v_offset, int __pyx_v_level) {
+  int __pyx_v_child_size;
+  int __pyx_v_bin_index;
+  int __pyx_v_child_min;
+  PyObject *__pyx_v_child_offset;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PY_LONG_LONG __pyx_t_6;
+  __Pyx_SetupRefcountContext("r_get_helper");
+  __pyx_v_child_offset = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":133
+ *     cdef r_get_helper( self, int index, int min, long long offset, int level ):
+ *         cdef int child_size, bin_index, child_min
+ *         self.io.seek( offset )             # <<<<<<<<<<<<<<
+ *         if level > 0:
+ *             child_size = self.block_size ** level
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_seek); 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_t_2 = PyLong_FromLongLong(__pyx_v_offset); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":134
+ *         cdef int child_size, bin_index, child_min
+ *         self.io.seek( offset )
+ *         if level > 0:             # <<<<<<<<<<<<<<
+ *             child_size = self.block_size ** level
+ *             bin_index = ( index - min ) // ( child_size )
+ */
+  __pyx_t_4 = (__pyx_v_level > 0);
+  if (__pyx_t_4) {
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":135
+ *         self.io.seek( offset )
+ *         if level > 0:
+ *             child_size = self.block_size ** level             # <<<<<<<<<<<<<<
+ *             bin_index = ( index - min ) // ( child_size )
+ *             child_min = min + ( bin_index * child_size )
+ */
+    __pyx_v_child_size = __Pyx_pow_int(__pyx_v_self->block_size, __pyx_v_level);
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":136
+ *         if level > 0:
+ *             child_size = self.block_size ** level
+ *             bin_index = ( index - min ) // ( child_size )             # <<<<<<<<<<<<<<
+ *             child_min = min + ( bin_index * child_size )
+ *             # Skip summary arrays -- 5 arrays * itemsize * block_size
+ */
+    __pyx_v_bin_index = ((__pyx_v_index - __pyx_v_min) / __pyx_v_child_size);
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":137
+ *             child_size = self.block_size ** level
+ *             bin_index = ( index - min ) // ( child_size )
+ *             child_min = min + ( bin_index * child_size )             # <<<<<<<<<<<<<<
+ *             # Skip summary arrays -- 5 arrays * itemsize * block_size
+ *             self.io.skip( 5 * self.dtype.itemsize * self.block_size )
+ */
+    __pyx_v_child_min = (__pyx_v_min + (__pyx_v_bin_index * __pyx_v_child_size));
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":139
+ *             child_min = min + ( bin_index * child_size )
+ *             # Skip summary arrays -- 5 arrays * itemsize * block_size
+ *             self.io.skip( 5 * self.dtype.itemsize * self.block_size )             # <<<<<<<<<<<<<<
+ *             # Skip to offset of correct child -- offsets are 8 bytes
+ *             self.io.skip( 8 * bin_index )
+ */
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->dtype, __pyx_kp_itemsize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_1 = PyNumber_Multiply(__pyx_int_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyInt_FromLong(__pyx_v_self->block_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
+    __Pyx_GIVEREF(__pyx_t_5);
+    __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":141
+ *             self.io.skip( 5 * self.dtype.itemsize * self.block_size )
+ *             # Skip to offset of correct child -- offsets are 8 bytes
+ *             self.io.skip( 8 * bin_index )             # <<<<<<<<<<<<<<
+ *             # Read offset of child
+ *             child_offset = self.io.read_uint64()
+ */
+    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_skip); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_3 = PyInt_FromLong((8 * __pyx_v_bin_index)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
+    __Pyx_GIVEREF(__pyx_t_3);
+    __pyx_t_3 = 0;
+    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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(__pyx_t_3); __pyx_t_3 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":143
+ *             self.io.skip( 8 * bin_index )
+ *             # Read offset of child
+ *             child_offset = self.io.read_uint64()             # <<<<<<<<<<<<<<
+ *             return self.r_get_helper( index, child_min, child_offset, level - 1 )
+ *         else:
+ */
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_40); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_v_child_offset);
+    __pyx_v_child_offset = __pyx_t_2;
+    __pyx_t_2 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":144
+ *             # Read offset of child
+ *             child_offset = self.io.read_uint64()
+ *             return self.r_get_helper( index, child_min, child_offset, level - 1 )             # <<<<<<<<<<<<<<
+ *         else:
+ *             self.io.skip( self.dtype.itemsize * ( index - min ) )
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_v_child_offset); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_6arrays_10array_tree_FileArrayTree *)__pyx_v_self->__pyx_vtab)->r_get_helper(__pyx_v_self, __pyx_v_index, __pyx_v_child_min, __pyx_t_6, (__pyx_v_level - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_r = __pyx_t_2;
+    __pyx_t_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":146
+ *             return self.r_get_helper( index, child_min, child_offset, level - 1 )
+ *         else:
+ *             self.io.skip( self.dtype.itemsize * ( index - min ) )             # <<<<<<<<<<<<<<
+ *             return self.io.read_raw_array( self.dtype, 1 )[0]
+ * 
+ */
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_skip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self->dtype, __pyx_kp_itemsize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyInt_FromLong((__pyx_v_index - __pyx_v_min)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":147
+ *         else:
+ *             self.io.skip( self.dtype.itemsize * ( index - min ) )
+ *             return self.io.read_raw_array( self.dtype, 1 )[0]             # <<<<<<<<<<<<<<
+ * 
+ * cdef class Summary:
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->io, __pyx_kp_read_raw_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __Pyx_INCREF(__pyx_v_self->dtype);
+    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->dtype);
+    __Pyx_GIVEREF(__pyx_v_self->dtype);
+    __Pyx_INCREF(__pyx_int_1);
+    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_1);
+    __Pyx_GIVEREF(__pyx_int_1);
+    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __pyx_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_r = __pyx_1;
+    __pyx_1 = 0;
+    goto __pyx_L0;
+  }
+  __pyx_L3:;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_1);
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("bx.arrays.array_tree.FileArrayTree.r_get_helper");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_child_offset);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_FinishRefcountContext();
+  return __pyx_r;
+}
+
+/* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":183
  *     cdef object dtype
  *     cdef int levels
  *     cdef public ArrayTreeNode root             # <<<<<<<<<<<<<<
 static int __pyx_pf_2bx_6arrays_10array_tree_9ArrayTree_4root___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
   int __pyx_r;
   __Pyx_SetupRefcountContext("__set__");
-  if (!(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (!(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_INCREF(__pyx_v_value);
   __Pyx_GIVEREF(__pyx_v_value);
   __Pyx_GOTREF(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->root);
   return __pyx_r;
 }
 
-/* "/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":185
  *     cdef public ArrayTreeNode root
  * 
  *     def __init__( self, int max, int block_size, dtype=float32 ):             # <<<<<<<<<<<<<<
   if (unlikely(__pyx_kwds)) {
     Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
     PyObject* values[3] = {0,0,0};
-    values[2] = __pyx_k_27;
+    values[2] = __pyx_k_31;
     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_block_size);
       if (likely(values[1])) kw_args--;
       else {
-        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    }
-    __pyx_v_max = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-    __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_max = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_block_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
     __pyx_v_dtype = values[2];
   } else {
-    __pyx_v_dtype = __pyx_k_27;
+    __pyx_v_dtype = __pyx_k_31;
     switch (PyTuple_GET_SIZE(__pyx_args)) {
       case  3:
       __pyx_v_dtype = PyTuple_GET_ITEM(__pyx_args, 2);
       case  2:
-      __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
-      __pyx_v_max = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_block_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_block_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      __pyx_v_max = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_max == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       break;
       default: goto __pyx_L5_argtuple_error;
     }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("bx.arrays.array_tree.ArrayTree.__init__");
   return -1;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":98
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":189
  *         Create a new array tree of size `max`
  *         """
  *         self.max = max             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max = __pyx_v_max;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":99
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":190
  *         """
  *         self.max = max
  *         self.block_size = block_size             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size = __pyx_v_block_size;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":101
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":192
  *         self.block_size = block_size
  *         # Force the dtype argument to its canonical dtype object
  *         self.dtype = numpy.dtype( dtype )             # <<<<<<<<<<<<<<
  *         # How many levels are needed to cover the entire range?
  *         self.levels = 0
  */
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_INCREF(__pyx_v_dtype);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dtype);
   __Pyx_GIVEREF(__pyx_v_dtype);
-  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
   __Pyx_GIVEREF(__pyx_t_2);
   ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->dtype = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":103
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":194
  *         self.dtype = numpy.dtype( dtype )
  *         # How many levels are needed to cover the entire range?
  *         self.levels = 0             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels = 0;
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":104
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":195
  *         # How many levels are needed to cover the entire range?
  *         self.levels = 0
  *         while self.block_size ** ( self.levels + 1 ) < self.max:             # <<<<<<<<<<<<<<
     __pyx_t_3 = (__Pyx_pow_long(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->block_size, (((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels + 1)) < ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->max);
     if (!__pyx_t_3) break;
 
-    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":105
+    /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":196
  *         self.levels = 0
  *         while self.block_size ** ( self.levels + 1 ) < self.max:
  *             self.levels += 1             # <<<<<<<<<<<<<<
     ((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels += 1;
   }
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":107
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":198
  *             self.levels += 1
  *         # Not yet dealing with the case where the root is a Leaf
  *         assert self.levels > 0, "max < block_size not yet handled"             # <<<<<<<<<<<<<<
  */
   #ifndef PYREX_WITHOUT_ASSERTIONS
   if (unlikely(!(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels > 0))) {
-    PyErr_SetObject(PyExc_AssertionError, __pyx_kp_28);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    PyErr_SetObject(PyExc_AssertionError, __pyx_kp_41);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   #endif
 
-  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":109
+  /* "/Users/james/projects/bx-python/code/bx-python-central/lib/bx/arrays/array_tree.pyx":200
  *         assert self.levels > 0, "max < block_size not yet handled"
  *         # Create the root node
  *         self.root = ArrayTreeNode( self, 0, max, block_size, self.levels )             # <<<<<<<<<<<<<<
  * 
  *     def __setitem__( self, int index, value ):
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_block_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_2bx_6arrays_10array_tree_ArrayTree *)__pyx_v_self)->levels); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_INCREF(__pyx_v_self);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
   __pyx_t_2 = 0;
   __pyx_t_1 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
-  if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_2bx_6arrays_10array_tree_ArrayTreeNode))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}