James Taylor avatar James Taylor committed 8e4809b

bigbed support

Comments (0)

Files changed (4)

lib/bx/bbi/bigbed_file.c

+/* Generated by Cython 0.14.1 on Wed Mar 23 22:52:00 2011 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+    #error Python headers needed to compile C extensions, please install development version of Python.
+#else
+
+#include <stddef.h> /* For offsetof */
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+  #ifndef __stdcall
+    #define __stdcall
+  #endif
+  #ifndef __cdecl
+    #define __cdecl
+  #endif
+  #ifndef __fastcall
+    #define __fastcall
+  #endif
+#endif
+
+#ifndef DL_IMPORT
+  #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+  #define DL_EXPORT(t) t
+#endif
+
+#ifndef PY_LONG_LONG
+  #define PY_LONG_LONG LONG_LONG
+#endif
+
+#if PY_VERSION_HEX < 0x02040000
+  #define METH_COEXIST 0
+  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  typedef int Py_ssize_t;
+  #define PY_SSIZE_T_MAX INT_MAX
+  #define PY_SSIZE_T_MIN INT_MIN
+  #define PY_FORMAT_SIZE_T ""
+  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
+  #define PyNumber_Index(o)    PyNumber_Int(o)
+  #define PyIndex_Check(o)     PyNumber_Check(o)
+  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
+  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
+  #define PyVarObject_HEAD_INIT(type, size) \
+          PyObject_HEAD_INIT(type) size,
+  #define PyType_Modified(t)
+
+  typedef struct {
+     void *buf;
+     PyObject *obj;
+     Py_ssize_t len;
+     Py_ssize_t itemsize;
+     int readonly;
+     int ndim;
+     char *format;
+     Py_ssize_t *shape;
+     Py_ssize_t *strides;
+     Py_ssize_t *suboffsets;
+     void *internal;
+  } Py_buffer;
+
+  #define PyBUF_SIMPLE 0
+  #define PyBUF_WRITABLE 0x0001
+  #define PyBUF_FORMAT 0x0004
+  #define PyBUF_ND 0x0008
+  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+
+#if PY_MAJOR_VERSION < 3
+  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define Py_TPFLAGS_CHECKTYPES 0
+  #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyBaseString_Type            PyUnicode_Type
+  #define PyStringObject               PyUnicodeObject
+  #define PyString_Type                PyUnicode_Type
+  #define PyString_Check               PyUnicode_Check
+  #define PyString_CheckExact          PyUnicode_CheckExact
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define PyBytesObject                PyStringObject
+  #define PyBytes_Type                 PyString_Type
+  #define PyBytes_Check                PyString_Check
+  #define PyBytes_CheckExact           PyString_CheckExact
+  #define PyBytes_FromString           PyString_FromString
+  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
+  #define PyBytes_FromFormat           PyString_FromFormat
+  #define PyBytes_DecodeEscape         PyString_DecodeEscape
+  #define PyBytes_AsString             PyString_AsString
+  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
+  #define PyBytes_Size                 PyString_Size
+  #define PyBytes_AS_STRING            PyString_AS_STRING
+  #define PyBytes_GET_SIZE             PyString_GET_SIZE
+  #define PyBytes_Repr                 PyString_Repr
+  #define PyBytes_Concat               PyString_Concat
+  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
+  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+#endif
+#ifndef PySet_CheckExact
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
+#endif
+
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
+  #define PyInt_Type                   PyLong_Type
+  #define PyInt_Check(op)              PyLong_Check(op)
+  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
+  #define PyInt_FromString             PyLong_FromString
+  #define PyInt_FromUnicode            PyLong_FromUnicode
+  #define PyInt_FromLong               PyLong_FromLong
+  #define PyInt_FromSize_t             PyLong_FromSize_t
+  #define PyInt_FromSsize_t            PyLong_FromSsize_t
+  #define PyInt_AsLong                 PyLong_AsLong
+  #define PyInt_AS_LONG                PyLong_AS_LONG
+  #define PyInt_AsSsize_t              PyLong_AsSsize_t
+  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
+  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyBoolObject                 PyLongObject
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
+#endif
+
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
+#else
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_NAMESTR(n) ((char *)(n))
+  #define __Pyx_DOCSTR(n)  ((char *)(n))
+#else
+  #define __Pyx_NAMESTR(n) (n)
+  #define __Pyx_DOCSTR(n)  (n)
+#endif
+
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE_API__bx__bbi__bigbed_file
+#include "stdio.h"
+#include "stdlib.h"
+#include "numpy/arrayobject.h"
+#include "numpy/ufuncobject.h"
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
+/* inline attribute */
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+
+/* unused attribute */
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
+#   else
+#     define CYTHON_UNUSED
+#   endif
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+#   define CYTHON_UNUSED
+# endif
+#endif
+
+typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+
+/* Type Conversion Predeclarations */
+
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+
+
+#ifdef __GNUC__
+/* Test for GCC > 2.95 */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* __GNUC__ > 2 ... */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ > 2 ... */
+#else /* __GNUC__ */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ */
+    
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+#if !defined(CYTHON_CCOMPLEX)
+  #if defined(__cplusplus)
+    #define CYTHON_CCOMPLEX 1
+  #elif defined(_Complex_I)
+    #define CYTHON_CCOMPLEX 1
+  #else
+    #define CYTHON_CCOMPLEX 0
+  #endif
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #include <complex>
+  #else
+    #include <complex.h>
+  #endif
+#endif
+
+#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
+  #undef _Complex_I
+  #define _Complex_I 1.0fj
+#endif
+
+static const char *__pyx_f[] = {
+  "bigbed_file.pyx",
+  "numpy.pxd",
+  "bpt_file.pxd",
+  "cirtree_file.pxd",
+  "bbi_file.pxd",
+};
+
+typedef unsigned char __pyx_t_2bx_3bbi_5types_UBYTE;
+
+typedef signed char __pyx_t_2bx_3bbi_5types_BYTE;
+
+typedef unsigned short __pyx_t_2bx_3bbi_5types_UWORD;
+
+typedef short __pyx_t_2bx_3bbi_5types_WORD;
+
+typedef unsigned PY_LONG_LONG __pyx_t_2bx_3bbi_5types_bits64;
+
+typedef unsigned int __pyx_t_2bx_3bbi_5types_bits32;
+
+typedef unsigned short __pyx_t_2bx_3bbi_5types_bits16;
+
+typedef unsigned char __pyx_t_2bx_3bbi_5types_bits8;
+
+typedef int __pyx_t_2bx_3bbi_5types_signed32;
+
+typedef int __pyx_t_2bx_3bbi_5types_boolean;
+
+typedef npy_int8 __pyx_t_5numpy_int8_t;
+
+typedef npy_int16 __pyx_t_5numpy_int16_t;
+
+typedef npy_int32 __pyx_t_5numpy_int32_t;
+
+typedef npy_int64 __pyx_t_5numpy_int64_t;
+
+typedef npy_uint8 __pyx_t_5numpy_uint8_t;
+
+typedef npy_uint16 __pyx_t_5numpy_uint16_t;
+
+typedef npy_uint32 __pyx_t_5numpy_uint32_t;
+
+typedef npy_uint64 __pyx_t_5numpy_uint64_t;
+
+typedef npy_float32 __pyx_t_5numpy_float32_t;
+
+typedef npy_float64 __pyx_t_5numpy_float64_t;
+
+typedef npy_long __pyx_t_5numpy_int_t;
+
+typedef npy_longlong __pyx_t_5numpy_long_t;
+
+typedef npy_intp __pyx_t_5numpy_intp_t;
+
+typedef npy_uintp __pyx_t_5numpy_uintp_t;
+
+typedef npy_ulong __pyx_t_5numpy_uint_t;
+
+typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
+
+typedef npy_double __pyx_t_5numpy_float_t;
+
+typedef npy_double __pyx_t_5numpy_double_t;
+
+typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< float > __pyx_t_float_complex;
+  #else
+    typedef float _Complex __pyx_t_float_complex;
+  #endif
+#else
+    typedef struct { float real, imag; } __pyx_t_float_complex;
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< double > __pyx_t_double_complex;
+  #else
+    typedef double _Complex __pyx_t_double_complex;
+  #endif
+#else
+    typedef struct { double real, imag; } __pyx_t_double_complex;
+#endif
+
+/* Type declarations */
+
+typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
+
+typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
+
+typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
+
+typedef npy_cdouble __pyx_t_5numpy_complex_t;
+
+/* "bbi_file.pxd":8
+ * cimport numpy
+ * 
+ * cdef class SummaryBlock:             # <<<<<<<<<<<<<<
+ *     """
+ *     A block of summary data from disk
+ */
+
+struct __pyx_obj_2bx_3bbi_8bbi_file_SummaryBlock {
+  PyObject_HEAD
+  __pyx_t_2bx_3bbi_5types_bits32 chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 start;
+  __pyx_t_2bx_3bbi_5types_bits32 end;
+  __pyx_t_2bx_3bbi_5types_bits32 valid_count;
+  double min_val;
+  double max_val;
+  double sum_data;
+  double sum_squares;
+};
+
+/* "bbi_file.pxd":35
+ *     cdef public numpy.ndarray sum_squares
+ * 
+ * cdef class BBIFile             # <<<<<<<<<<<<<<
+ * 
+ * cdef class BlockHandler:
+ */
+
+struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtab;
+  PyObject *file;
+  PyObject *reader;
+  __pyx_t_2bx_3bbi_5types_bits32 magic;
+  __pyx_t_2bx_3bbi_5types_boolean is_byteswapped;
+  struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile *chrom_bpt;
+  __pyx_t_2bx_3bbi_5types_bits16 version;
+  __pyx_t_2bx_3bbi_5types_bits16 zoom_levels;
+  __pyx_t_2bx_3bbi_5types_bits64 chrom_tree_offset;
+  __pyx_t_2bx_3bbi_5types_bits64 unzoomed_data_offset;
+  __pyx_t_2bx_3bbi_5types_bits64 unzoomed_index_offset;
+  __pyx_t_2bx_3bbi_5types_bits16 field_count;
+  __pyx_t_2bx_3bbi_5types_bits16 defined_field_count;
+  __pyx_t_2bx_3bbi_5types_bits64 as_offset;
+  __pyx_t_2bx_3bbi_5types_bits64 total_summary_offset;
+  __pyx_t_2bx_3bbi_5types_bits32 uncompress_buf_size;
+  PyObject *level_list;
+};
+
+/* "bx/bbi/bigbed_file.pyx":85
+ *         self.intervals.append( ( s, e, rest ) )
+ * 
+ * cdef class BigBedFile( BBIFile ):             # <<<<<<<<<<<<<<
+ *     """
+ *     A "big binary indexed" file whose raw data is in BED format.
+ */
+
+struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile {
+  struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile __pyx_base;
+};
+
+/* "bbi_file.pxd":37
+ * cdef class BBIFile
+ * 
+ * cdef class BlockHandler:             # <<<<<<<<<<<<<<
+ *     """
+ *     Callback for `BBIFile.visit_blocks_in_region`
+ */
+
+struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtab;
+};
+
+/* "bx/bbi/bigbed_file.pyx":20
+ *     return min( end1, end2 ) - max( start1, start2 )
+ * 
+ * cdef class BigBedBlockHandler( BlockHandler ):             # <<<<<<<<<<<<<<
+ *     """
+ *     BlockHandler that parses the block into a series of BED records
+ */
+
+struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler {
+  struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler __pyx_base;
+  __pyx_t_2bx_3bbi_5types_bits32 chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 start;
+  __pyx_t_2bx_3bbi_5types_bits32 end;
+};
+
+/* "cirtree_file.pxd":3
+ * from types cimport *
+ * 
+ * cdef class CIRTreeFile:             # <<<<<<<<<<<<<<
+ *     cdef object file
+ *     cdef object reader
+ */
+
+struct __pyx_obj_2bx_3bbi_12cirtree_file_CIRTreeFile {
+  PyObject_HEAD
+  PyObject *file;
+  PyObject *reader;
+  __pyx_t_2bx_3bbi_5types_boolean is_byteswapped;
+  __pyx_t_2bx_3bbi_5types_bits64 root_offset;
+  __pyx_t_2bx_3bbi_5types_bits32 block_size;
+  __pyx_t_2bx_3bbi_5types_bits64 item_count;
+  __pyx_t_2bx_3bbi_5types_bits32 start_chrom_ix;
+  __pyx_t_2bx_3bbi_5types_bits32 start_base;
+  __pyx_t_2bx_3bbi_5types_bits32 end_chrom_ix;
+  __pyx_t_2bx_3bbi_5types_bits32 end_base;
+  __pyx_t_2bx_3bbi_5types_bits64 file_size;
+  __pyx_t_2bx_3bbi_5types_bits32 items_per_slot;
+};
+
+/* "bbi_file.pxd":21
+ *     cdef public double sum_squares
+ * 
+ * cdef class SummarizedData:             # <<<<<<<<<<<<<<
+ *     """
+ *     The result of using SummaryBlocks read from the file to produce a
+ */
+
+struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData {
+  PyObject_HEAD
+  __pyx_t_2bx_3bbi_5types_bits32 start;
+  __pyx_t_2bx_3bbi_5types_bits32 end;
+  int size;
+  PyArrayObject *valid_count;
+  PyArrayObject *min_val;
+  PyArrayObject *max_val;
+  PyArrayObject *sum_data;
+  PyArrayObject *sum_squares;
+};
+
+/* "bx/bbi/bigbed_file.pyx":54
+ *         pass
+ * 
+ * cdef class SummarizingBlockHandler( BigBedBlockHandler ):             # <<<<<<<<<<<<<<
+ *     """
+ *     Accumulates intervals into a SummarizedData
+ */
+
+struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler {
+  struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base;
+  struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *sd;
+};
+
+/* "bx/bbi/bigbed_file.pyx":73
+ *         self.sd.accumulate_interval_value( s, e, 1 )
+ * 
+ * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ):             # <<<<<<<<<<<<<<
+ *     cdef list intervals
+ *     """
+ */
+
+struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler {
+  struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base;
+  PyObject *intervals;
+};
+
+/* "bpt_file.pxd":5
+ * from types cimport *
+ * 
+ * cdef class BPTFile:             # <<<<<<<<<<<<<<
+ *     """
+ *     On disk B+ tree compatible with Jim Kent's bPlusTree.c
+ */
+
+struct __pyx_obj_2bx_3bbi_8bpt_file_BPTFile {
+  PyObject_HEAD
+  PyObject *file;
+  PyObject *reader;
+  __pyx_t_2bx_3bbi_5types_boolean is_byteswapped;
+  __pyx_t_2bx_3bbi_5types_bits32 block_size;
+  __pyx_t_2bx_3bbi_5types_bits32 key_size;
+  __pyx_t_2bx_3bbi_5types_bits32 value_size;
+  __pyx_t_2bx_3bbi_5types_bits64 item_count;
+  __pyx_t_2bx_3bbi_5types_bits64 root_offset;
+};
+
+
+/* "bbi_file.pxd":35
+ *     cdef public numpy.ndarray sum_squares
+ * 
+ * cdef class BBIFile             # <<<<<<<<<<<<<<
+ * 
+ * cdef class BlockHandler:
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile {
+  PyObject *(*visit_blocks_in_region)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *);
+  PyObject *(*_get_chrom_id_and_size)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *);
+  PyObject *(*_best_zoom_level)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, int);
+  PyObject *(*summarize)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch);
+  PyObject *(*summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch);
+  PyObject *(*query)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int, int __pyx_skip_dispatch);
+  PyObject *(*_summarize_from_full)(struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int);
+};
+static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile *__pyx_vtabptr_2bx_3bbi_8bbi_file_BBIFile;
+
+
+/* "bx/bbi/bigbed_file.pyx":85
+ *         self.intervals.append( ( s, e, rest ) )
+ * 
+ * cdef class BigBedFile( BBIFile ):             # <<<<<<<<<<<<<<
+ *     """
+ *     A "big binary indexed" file whose raw data is in BED format.
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile {
+  struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BBIFile __pyx_base;
+  PyObject *(*get)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedFile *, char *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, int __pyx_skip_dispatch);
+};
+static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedFile *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedFile;
+
+
+/* "bbi_file.pxd":37
+ * cdef class BBIFile
+ * 
+ * cdef class BlockHandler:             # <<<<<<<<<<<<<<
+ *     """
+ *     Callback for `BBIFile.visit_blocks_in_region`
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler {
+  PyObject *(*handle_block)(struct __pyx_obj_2bx_3bbi_8bbi_file_BlockHandler *, PyObject *, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *);
+};
+static struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler *__pyx_vtabptr_2bx_3bbi_8bbi_file_BlockHandler;
+
+
+/* "bx/bbi/bigbed_file.pyx":20
+ *     return min( end1, end2 ) - max( start1, start2 )
+ * 
+ * cdef class BigBedBlockHandler( BlockHandler ):             # <<<<<<<<<<<<<<
+ *     """
+ *     BlockHandler that parses the block into a series of BED records
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler {
+  struct __pyx_vtabstruct_2bx_3bbi_8bbi_file_BlockHandler __pyx_base;
+  PyObject *(*handle_interval_value)(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *, __pyx_t_2bx_3bbi_5types_bits32, __pyx_t_2bx_3bbi_5types_bits32, PyObject *);
+};
+static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_BigBedBlockHandler;
+
+
+/* "bx/bbi/bigbed_file.pyx":73
+ *         self.sd.accumulate_interval_value( s, e, 1 )
+ * 
+ * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ):             # <<<<<<<<<<<<<<
+ *     cdef list intervals
+ *     """
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler {
+  struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base;
+};
+static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler;
+
+
+/* "bx/bbi/bigbed_file.pyx":54
+ *         pass
+ * 
+ * cdef class SummarizingBlockHandler( BigBedBlockHandler ):             # <<<<<<<<<<<<<<
+ *     """
+ *     Accumulates intervals into a SummarizedData
+ */
+
+struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_SummarizingBlockHandler {
+  struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler __pyx_base;
+};
+static struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *__pyx_vtabptr_2bx_3bbi_11bigbed_file_SummarizingBlockHandler;
+
+#ifndef CYTHON_REFNANNY
+  #define CYTHON_REFNANNY 0
+#endif
+
+#if CYTHON_REFNANNY
+  typedef struct {
+    void (*INCREF)(void*, PyObject*, int);
+    void (*DECREF)(void*, PyObject*, int);
+    void (*GOTREF)(void*, PyObject*, int);
+    void (*GIVEREF)(void*, PyObject*, int);
+    void* (*SetupContext)(const char*, int, const char*);
+    void (*FinishContext)(void**);
+  } __Pyx_RefNannyAPIStruct;
+  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
+    PyObject *m = NULL, *p = NULL;
+    void *r = NULL;
+    m = PyImport_ImportModule((char *)modname);
+    if (!m) goto end;
+    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+    if (!p) goto end;
+    r = PyLong_AsVoidPtr(p);
+  end:
+    Py_XDECREF(p);
+    Py_XDECREF(m);
+    return (__Pyx_RefNannyAPIStruct *)r;
+  }
+  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
+#else
+  #define __Pyx_RefNannySetupContext(name)
+  #define __Pyx_RefNannyFinishContext()
+  #define __Pyx_INCREF(r) Py_INCREF(r)
+  #define __Pyx_DECREF(r) Py_DECREF(r)
+  #define __Pyx_GOTREF(r)
+  #define __Pyx_GIVEREF(r)
+  #define __Pyx_XDECREF(r) Py_XDECREF(r)
+#endif /* CYTHON_REFNANNY */
+#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
+#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static 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) : \
+                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
+
+static CYTHON_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 CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
+    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 = PyInt_FromSsize_t(i);
+        return __Pyx_SetItemInt_Generic(o, j, v);
+    }
+}
+
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+
+
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+    PyObject *r;
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+        r = PySequence_GetItem(o, i);
+    }
+    else {
+        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+    }
+    return r;
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
+static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #define __Pyx_CREAL(z) ((z).real())
+    #define __Pyx_CIMAG(z) ((z).imag())
+  #else
+    #define __Pyx_CREAL(z) (__real__(z))
+    #define __Pyx_CIMAG(z) (__imag__(z))
+  #endif
+#else
+    #define __Pyx_CREAL(z) ((z).real)
+    #define __Pyx_CIMAG(z) ((z).imag)
+#endif
+
+#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
+    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
+    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
+#else
+    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
+    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
+#endif
+
+static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eqf(a, b)   ((a)==(b))
+    #define __Pyx_c_sumf(a, b)  ((a)+(b))
+    #define __Pyx_c_difff(a, b) ((a)-(b))
+    #define __Pyx_c_prodf(a, b) ((a)*(b))
+    #define __Pyx_c_quotf(a, b) ((a)/(b))
+    #define __Pyx_c_negf(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
+    #define __Pyx_c_conjf(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (::std::abs(z))
+        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zerof(z) ((z)==0)
+    #define __Pyx_c_conjf(z)    (conjf(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (cabsf(z))
+        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
+    #if 1
+        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
+        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
+    #endif
+#endif
+
+static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eq(a, b)   ((a)==(b))
+    #define __Pyx_c_sum(a, b)  ((a)+(b))
+    #define __Pyx_c_diff(a, b) ((a)-(b))
+    #define __Pyx_c_prod(a, b) ((a)*(b))
+    #define __Pyx_c_quot(a, b) ((a)/(b))
+    #define __Pyx_c_neg(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zero(z) ((z)==(double)0)
+    #define __Pyx_c_conj(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (::std::abs(z))
+        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zero(z) ((z)==0)
+    #define __Pyx_c_conj(z)    (conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (cabs(z))
+        #define __Pyx_c_pow(a, b)  (cpow(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
+    #if 1
+        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
+        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
+    #endif
+#endif
+
+static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+
+static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+
+static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
+
+static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
+
+static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+
+static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+
+static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
+
+static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
+
+static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
+
+static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
+
+static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
+
+static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
+
+static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict);  /*proto*/
+
+static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
+
+static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
+
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
+static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+/* Module declarations from bx.bbi.types */
+
+/* Module declarations from bx.bbi.bpt_file */
+
+static PyTypeObject *__pyx_ptype_2bx_3bbi_8bpt_file_BPTFile = 0;
+/* Module declarations from bx.bbi.cirtree_file */
+
+static PyTypeObject *__pyx_ptype_2bx_3bbi_12cirtree_file_CIRTreeFile = 0;
+/* Module declarations from cpython.buffer */
+
+/* Module declarations from cpython.ref */
+
+/* Module declarations from libc.stdio */
+
+/* Module declarations from cpython.object */
+
+/* Module declarations from libc.stdlib */
+
+/* Module declarations from numpy */
+
+/* Module declarations from numpy */
+
+static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
+static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
+static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
+static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/
+/* Module declarations from bx.bbi.bbi_file */
+
+static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummaryBlock = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BBIFile = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler = 0;
+/* Module declarations from bx.bbi.bigbed_file */
+
+static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_SummarizingBlockHandler = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler = 0;
+static PyTypeObject *__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedFile = 0;
+static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigbed_file_range_intersection(int, int, int, int); /*proto*/
+#define __Pyx_MODULE_NAME "bx.bbi.bigbed_file"
+static int __pyx_module_is_main_bx__bbi__bigbed_file = 0;
+
+/* Implementation of bx.bbi.bigbed_file */
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_round;
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_RuntimeError;
+static char __pyx_k_1[] = "handle_interval_value";
+static char __pyx_k_2[] = "accumulate_interval_value";
+static char __pyx_k_3[] = "visit_blocks_in_region";
+static char __pyx_k_4[] = "_get_chrom_id_and_size";
+static char __pyx_k_5[] = "\t";
+static char __pyx_k_7[] = "+";
+static char __pyx_k_8[] = "ndarray is not C contiguous";
+static char __pyx_k_10[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_12[] = "Non-native byte order not supported";
+static char __pyx_k_14[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_15[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_18[] = "Format string allocated too short.";
+static char __pyx_k_20[] = "\nBigBed file.\n";
+static char __pyx_k_21[] = "bx.intervals.io";
+static char __pyx_k_22[] = "bx.misc.binary_file";
+static char __pyx_k__B[] = "B";
+static char __pyx_k__H[] = "H";
+static char __pyx_k__I[] = "I";
+static char __pyx_k__L[] = "L";
+static char __pyx_k__O[] = "O";
+static char __pyx_k__Q[] = "Q";
+static char __pyx_k__b[] = "b";
+static char __pyx_k__d[] = "d";
+static char __pyx_k__f[] = "f";
+static char __pyx_k__g[] = "g";
+static char __pyx_k__h[] = "h";
+static char __pyx_k__i[] = "i";
+static char __pyx_k__l[] = "l";
+static char __pyx_k__q[] = "q";
+static char __pyx_k__Zd[] = "Zd";
+static char __pyx_k__Zf[] = "Zf";
+static char __pyx_k__Zg[] = "Zg";
+static char __pyx_k__sd[] = "sd";
+static char __pyx_k__buf[] = "buf";
+static char __pyx_k__end[] = "end";
+static char __pyx_k__get[] = "get";
+static char __pyx_k__inf[] = "inf";
+static char __pyx_k__obj[] = "obj";
+static char __pyx_k__base[] = "base";
+static char __pyx_k__file[] = "file";
+static char __pyx_k__ndim[] = "ndim";
+static char __pyx_k__tell[] = "tell";
+static char __pyx_k__zlib[] = "zlib";
+static char __pyx_k__chrom[] = "chrom";
+static char __pyx_k__descr[] = "descr";
+static char __pyx_k__names[] = "names";
+static char __pyx_k__numpy[] = "numpy";
+static char __pyx_k__range[] = "range";
+static char __pyx_k__round[] = "round";
+static char __pyx_k__shape[] = "shape";
+static char __pyx_k__split[] = "split";
+static char __pyx_k__start[] = "start";
+static char __pyx_k__append[] = "append";
+static char __pyx_k__bigbed[] = "bigbed";
+static char __pyx_k__fields[] = "fields";
+static char __pyx_k__format[] = "format";
+static char __pyx_k__reader[] = "reader";
+static char __pyx_k__max_val[] = "max_val";
+static char __pyx_k__min_val[] = "min_val";
+static char __pyx_k__strides[] = "strides";
+static char __pyx_k__StringIO[] = "StringIO";
+static char __pyx_k____init__[] = "__init__";
+static char __pyx_k____main__[] = "__main__";
+static char __pyx_k____test__[] = "__test__";
+static char __pyx_k__chrom_id[] = "chrom_id";
+static char __pyx_k__itemsize[] = "itemsize";
+static char __pyx_k__readonly[] = "readonly";
+static char __pyx_k__type_num[] = "type_num";
+static char __pyx_k__byteorder[] = "byteorder";
+static char __pyx_k__cStringIO[] = "cStringIO";
+static char __pyx_k__intervals[] = "intervals";
+static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k__suboffsets[] = "suboffsets";
+static char __pyx_k__read_uint32[] = "read_uint32";
+static char __pyx_k__valid_count[] = "valid_count";
+static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k__summary_size[] = "summary_size";
+static char __pyx_k__read_c_string[] = "read_c_string";
+static char __pyx_k__GenomicInterval[] = "GenomicInterval";
+static char __pyx_k__BinaryFileReader[] = "BinaryFileReader";
+static char __pyx_k__is_little_endian[] = "is_little_endian";
+static PyObject *__pyx_n_s_1;
+static PyObject *__pyx_kp_u_10;
+static PyObject *__pyx_kp_u_12;
+static PyObject *__pyx_kp_u_14;
+static PyObject *__pyx_kp_u_15;
+static PyObject *__pyx_kp_u_18;
+static PyObject *__pyx_n_s_2;
+static PyObject *__pyx_n_s_21;
+static PyObject *__pyx_n_s_22;
+static PyObject *__pyx_n_s_3;
+static PyObject *__pyx_n_s_4;
+static PyObject *__pyx_kp_s_5;
+static PyObject *__pyx_kp_s_7;
+static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_n_s__BinaryFileReader;
+static PyObject *__pyx_n_s__GenomicInterval;
+static PyObject *__pyx_n_s__RuntimeError;
+static PyObject *__pyx_n_s__StringIO;
+static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s____init__;
+static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s__append;
+static PyObject *__pyx_n_s__base;
+static PyObject *__pyx_n_s__bigbed;
+static PyObject *__pyx_n_s__buf;
+static PyObject *__pyx_n_s__byteorder;
+static PyObject *__pyx_n_s__cStringIO;
+static PyObject *__pyx_n_s__chrom;
+static PyObject *__pyx_n_s__chrom_id;
+static PyObject *__pyx_n_s__descr;
+static PyObject *__pyx_n_s__end;
+static PyObject *__pyx_n_s__fields;
+static PyObject *__pyx_n_s__file;
+static PyObject *__pyx_n_s__format;
+static PyObject *__pyx_n_s__get;
+static PyObject *__pyx_n_s__inf;
+static PyObject *__pyx_n_s__intervals;
+static PyObject *__pyx_n_s__is_little_endian;
+static PyObject *__pyx_n_s__itemsize;
+static PyObject *__pyx_n_s__max_val;
+static PyObject *__pyx_n_s__min_val;
+static PyObject *__pyx_n_s__names;
+static PyObject *__pyx_n_s__ndim;
+static PyObject *__pyx_n_s__numpy;
+static PyObject *__pyx_n_s__obj;
+static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__read_c_string;
+static PyObject *__pyx_n_s__read_uint32;
+static PyObject *__pyx_n_s__reader;
+static PyObject *__pyx_n_s__readonly;
+static PyObject *__pyx_n_s__round;
+static PyObject *__pyx_n_s__sd;
+static PyObject *__pyx_n_s__shape;
+static PyObject *__pyx_n_s__split;
+static PyObject *__pyx_n_s__start;
+static PyObject *__pyx_n_s__strides;
+static PyObject *__pyx_n_s__suboffsets;
+static PyObject *__pyx_n_s__summary_size;
+static PyObject *__pyx_n_s__tell;
+static PyObject *__pyx_n_s__type_num;
+static PyObject *__pyx_n_s__valid_count;
+static PyObject *__pyx_n_s__zlib;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_2;
+static PyObject *__pyx_int_5;
+static PyObject *__pyx_int_15;
+static PyObject *__pyx_int_2273964779;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_tuple_11;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_16;
+static PyObject *__pyx_k_tuple_17;
+static PyObject *__pyx_k_tuple_19;
+
+/* "bx/bbi/bigbed_file.pyx":17
+ * DEF big_bed_sig = 0x8789F2EB
+ * 
+ * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ):             # <<<<<<<<<<<<<<
+ *     return min( end1, end2 ) - max( start1, start2 )
+ * 
+ */
+
+static CYTHON_INLINE int __pyx_f_2bx_3bbi_11bigbed_file_range_intersection(int __pyx_v_start1, int __pyx_v_end1, int __pyx_v_start2, int __pyx_v_end2) {
+  int __pyx_r;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  int __pyx_t_4;
+  __Pyx_RefNannySetupContext("range_intersection");
+
+  /* "bx/bbi/bigbed_file.pyx":18
+ * 
+ * cdef inline int range_intersection( int start1, int end1, int start2, int end2 ):
+ *     return min( end1, end2 ) - max( start1, start2 )             # <<<<<<<<<<<<<<
+ * 
+ * cdef class BigBedBlockHandler( BlockHandler ):
+ */
+  __pyx_t_1 = __pyx_v_end2;
+  __pyx_t_2 = __pyx_v_end1;
+  if ((__pyx_t_1 < __pyx_t_2)) {
+    __pyx_t_3 = __pyx_t_1;
+  } else {
+    __pyx_t_3 = __pyx_t_2;
+  }
+  __pyx_t_1 = __pyx_v_start2;
+  __pyx_t_2 = __pyx_v_start1;
+  if ((__pyx_t_1 > __pyx_t_2)) {
+    __pyx_t_4 = __pyx_t_1;
+  } else {
+    __pyx_t_4 = __pyx_t_2;
+  }
+  __pyx_r = (__pyx_t_3 - __pyx_t_4);
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":27
+ *     cdef bits32 start
+ *     cdef bits32 end
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):             # <<<<<<<<<<<<<<
+ *         BlockHandler.__init__( self )
+ *         self.chrom_id = chrom_id
+ */
+
+static int __pyx_pf_2bx_3bbi_11bigbed_file_18BigBedBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_3bbi_11bigbed_file_18BigBedBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,0};
+  __Pyx_RefNannySetupContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[3] = {0,0,0};
+    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_n_s__chrom_id);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+      if (likely(values[2])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.__init__");
+  __Pyx_RefNannyFinishContext();
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "bx/bbi/bigbed_file.pyx":28
+ *     cdef bits32 end
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):
+ *         BlockHandler.__init__( self )             # <<<<<<<<<<<<<<
+ *         self.chrom_id = chrom_id
+ *         self.start = start
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_BlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
+  __Pyx_GIVEREF(__pyx_v_self);
+  __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 = 28; __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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":29
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):
+ *         BlockHandler.__init__( self )
+ *         self.chrom_id = chrom_id             # <<<<<<<<<<<<<<
+ *         self.start = start
+ *         self.end = end
+ */
+  ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->chrom_id = __pyx_v_chrom_id;
+
+  /* "bx/bbi/bigbed_file.pyx":30
+ *         BlockHandler.__init__( self )
+ *         self.chrom_id = chrom_id
+ *         self.start = start             # <<<<<<<<<<<<<<
+ *         self.end = end
+ *     cdef handle_block( self, str block_data, BBIFile bbi_file ):
+ */
+  ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->start = __pyx_v_start;
+
+  /* "bx/bbi/bigbed_file.pyx":31
+ *         self.chrom_id = chrom_id
+ *         self.start = start
+ *         self.end = end             # <<<<<<<<<<<<<<
+ *     cdef handle_block( self, str block_data, BBIFile bbi_file ):
+ *         cdef object string_io
+ */
+  ((struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self)->end = __pyx_v_end;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":32
+ *         self.start = start
+ *         self.end = end
+ *     cdef handle_block( self, str block_data, BBIFile bbi_file ):             # <<<<<<<<<<<<<<
+ *         cdef object string_io
+ *         cdef int length
+ */
+
+static  PyObject *__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_block(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_v_self, PyObject *__pyx_v_block_data, struct __pyx_obj_2bx_3bbi_8bbi_file_BBIFile *__pyx_v_bbi_file) {
+  PyObject *__pyx_v_string_io;
+  int __pyx_v_length;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e;
+  PyObject *__pyx_v_rest;
+  PyObject *__pyx_v_block_reader;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  Py_ssize_t __pyx_t_5;
+  int __pyx_t_6;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_t_7;
+  int __pyx_t_8;
+  int __pyx_t_9;
+  __Pyx_RefNannySetupContext("handle_block");
+  __pyx_v_string_io = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_rest = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_block_reader = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "bx/bbi/bigbed_file.pyx":38
+ *         cdef str rest
+ *         # Now we parse the block, which should just be a bunch of BED records
+ *         string_io = StringIO( block_data )             # <<<<<<<<<<<<<<
+ *         block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian )
+ *         length = len( block_data )
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(((PyObject *)__pyx_v_block_data));
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_block_data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_block_data));
+  __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 = 38; __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_DECREF(__pyx_v_string_io);
+  __pyx_v_string_io = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":39
+ *         # Now we parse the block, which should just be a bunch of BED records
+ *         string_io = StringIO( block_data )
+ *         block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian )             # <<<<<<<<<<<<<<
+ *         length = len( block_data )
+ *         while string_io.tell() < length:
+ */
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__BinaryFileReader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+  __Pyx_INCREF(__pyx_v_string_io);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_string_io);
+  __Pyx_GIVEREF(__pyx_v_string_io);
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_4 = PyObject_GetAttr(__pyx_v_bbi_file->reader, __pyx_n_s__is_little_endian); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__is_little_endian), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(__pyx_v_block_reader);
+  __pyx_v_block_reader = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":40
+ *         string_io = StringIO( block_data )
+ *         block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian )
+ *         length = len( block_data )             # <<<<<<<<<<<<<<
+ *         while string_io.tell() < length:
+ *             chrom_id = block_reader.read_uint32()
+ */
+  __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_block_data)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_length = __pyx_t_5;
+
+  /* "bx/bbi/bigbed_file.pyx":41
+ *         block_reader = BinaryFileReader( string_io, is_little_endian=bbi_file.reader.is_little_endian )
+ *         length = len( block_data )
+ *         while string_io.tell() < length:             # <<<<<<<<<<<<<<
+ *             chrom_id = block_reader.read_uint32()
+ *             s = block_reader.read_uint32()
+ */
+  while (1) {
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_string_io, __pyx_n_s__tell); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (!__pyx_t_6) break;
+
+    /* "bx/bbi/bigbed_file.pyx":42
+ *         length = len( block_data )
+ *         while string_io.tell() < length:
+ *             chrom_id = block_reader.read_uint32()             # <<<<<<<<<<<<<<
+ *             s = block_reader.read_uint32()
+ *             e = block_reader.read_uint32()
+ */
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_chrom_id = __pyx_t_7;
+
+    /* "bx/bbi/bigbed_file.pyx":43
+ *         while string_io.tell() < length:
+ *             chrom_id = block_reader.read_uint32()
+ *             s = block_reader.read_uint32()             # <<<<<<<<<<<<<<
+ *             e = block_reader.read_uint32()
+ *             rest = block_reader.read_c_string()
+ */
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_v_s = __pyx_t_7;
+
+    /* "bx/bbi/bigbed_file.pyx":44
+ *             chrom_id = block_reader.read_uint32()
+ *             s = block_reader.read_uint32()
+ *             e = block_reader.read_uint32()             # <<<<<<<<<<<<<<
+ *             rest = block_reader.read_c_string()
+ *             if chrom_id != self.chrom_id:
+ */
+    __pyx_t_2 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_uint32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_7 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_e = __pyx_t_7;
+
+    /* "bx/bbi/bigbed_file.pyx":45
+ *             s = block_reader.read_uint32()
+ *             e = block_reader.read_uint32()
+ *             rest = block_reader.read_c_string()             # <<<<<<<<<<<<<<
+ *             if chrom_id != self.chrom_id:
+ *                 continue
+ */
+    __pyx_t_4 = PyObject_GetAttr(__pyx_v_block_reader, __pyx_n_s__read_c_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_v_rest));
+    __pyx_v_rest = ((PyObject*)__pyx_t_2);
+    __pyx_t_2 = 0;
+
+    /* "bx/bbi/bigbed_file.pyx":46
+ *             e = block_reader.read_uint32()
+ *             rest = block_reader.read_c_string()
+ *             if chrom_id != self.chrom_id:             # <<<<<<<<<<<<<<
+ *                 continue
+ *             if s < self.end and e > self.start:
+ */
+    __pyx_t_6 = (__pyx_v_chrom_id != __pyx_v_self->chrom_id);
+    if (__pyx_t_6) {
+
+      /* "bx/bbi/bigbed_file.pyx":47
+ *             rest = block_reader.read_c_string()
+ *             if chrom_id != self.chrom_id:
+ *                 continue             # <<<<<<<<<<<<<<
+ *             if s < self.end and e > self.start:
+ *                 self.handle_interval_value( s, e, rest )
+ */
+      goto __pyx_L3_continue;
+      goto __pyx_L5;
+    }
+    __pyx_L5:;
+
+    /* "bx/bbi/bigbed_file.pyx":48
+ *             if chrom_id != self.chrom_id:
+ *                 continue
+ *             if s < self.end and e > self.start:             # <<<<<<<<<<<<<<
+ *                 self.handle_interval_value( s, e, rest )
+ * 
+ */
+    __pyx_t_6 = (__pyx_v_s < __pyx_v_self->end);
+    if (__pyx_t_6) {
+      __pyx_t_8 = (__pyx_v_e > __pyx_v_self->start);
+      __pyx_t_9 = __pyx_t_8;
+    } else {
+      __pyx_t_9 = __pyx_t_6;
+    }
+    if (__pyx_t_9) {
+
+      /* "bx/bbi/bigbed_file.pyx":49
+ *                 continue
+ *             if s < self.end and e > self.start:
+ *                 self.handle_interval_value( s, e, rest )             # <<<<<<<<<<<<<<
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):
+ */
+      __pyx_t_2 = ((struct __pyx_vtabstruct_2bx_3bbi_11bigbed_file_BigBedBlockHandler *)__pyx_v_self->__pyx_base.__pyx_vtab)->handle_interval_value(__pyx_v_self, __pyx_v_s, __pyx_v_e, __pyx_v_rest); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      goto __pyx_L6;
+    }
+    __pyx_L6:;
+    __pyx_L3_continue:;
+  }
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedBlockHandler.handle_block");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_DECREF(__pyx_v_string_io);
+  __Pyx_DECREF(__pyx_v_rest);
+  __Pyx_DECREF(__pyx_v_block_reader);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":51
+ *                 self.handle_interval_value( s, e, rest )
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):             # <<<<<<<<<<<<<<
+ *         pass
+ * 
+ */
+
+static  PyObject *__pyx_f_2bx_3bbi_11bigbed_file_18BigBedBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_BigBedBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannySetupContext("handle_interval_value");
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":59
+ *     """
+ *     cdef SummarizedData sd
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ):             # <<<<<<<<<<<<<<
+ *         BigBedBlockHandler.__init__( self, start, end )
+ *         # What we will load into
+ */
+
+static int __pyx_pf_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end;
+  int __pyx_v_summary_size;
+  int __pyx_v_i;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  int __pyx_t_6;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__summary_size,0};
+  __Pyx_RefNannySetupContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[4] = {0,0,0,0};
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_id);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+      if (likely(values[2])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  3:
+      values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__summary_size);
+      if (likely(values[3])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_summary_size = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_summary_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_summary_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.__init__");
+  __Pyx_RefNannyFinishContext();
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "bx/bbi/bigbed_file.pyx":60
+ *     cdef SummarizedData sd
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end, int summary_size ):
+ *         BigBedBlockHandler.__init__( self, start, end )             # <<<<<<<<<<<<<<
+ *         # What we will load into
+ *         self.sd = SummarizedData( start, end, summary_size )
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
+  __Pyx_GIVEREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_2 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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_4)); __pyx_t_4 = 0;
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":62
+ *         BigBedBlockHandler.__init__( self, start, end )
+ *         # What we will load into
+ *         self.sd = SummarizedData( start, end, summary_size )             # <<<<<<<<<<<<<<
+ *         for i in range(summary_size):
+ *             self.sd.min_val[i] = +numpy.inf
+ */
+  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_summary_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __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);
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_3 = 0;
+  __pyx_t_4 = 0;
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_8bbi_file_SummarizedData)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd));
+  ((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd = ((struct __pyx_obj_2bx_3bbi_8bbi_file_SummarizedData *)__pyx_t_1);
+  __pyx_t_1 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":63
+ *         # What we will load into
+ *         self.sd = SummarizedData( start, end, summary_size )
+ *         for i in range(summary_size):             # <<<<<<<<<<<<<<
+ *             self.sd.min_val[i] = +numpy.inf
+ *         for i in range(summary_size):
+ */
+  __pyx_t_5 = __pyx_v_summary_size;
+  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+    __pyx_v_i = __pyx_t_6;
+
+    /* "bx/bbi/bigbed_file.pyx":64
+ *         self.sd = SummarizedData( start, end, summary_size )
+ *         for i in range(summary_size):
+ *             self.sd.min_val[i] = +numpy.inf             # <<<<<<<<<<<<<<
+ *         for i in range(summary_size):
+ *             self.sd.max_val[i] = -numpy.inf
+ */
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyNumber_Positive(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd->min_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  }
+
+  /* "bx/bbi/bigbed_file.pyx":65
+ *         for i in range(summary_size):
+ *             self.sd.min_val[i] = +numpy.inf
+ *         for i in range(summary_size):             # <<<<<<<<<<<<<<
+ *             self.sd.max_val[i] = -numpy.inf
+ * 
+ */
+  __pyx_t_5 = __pyx_v_summary_size;
+  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+    __pyx_v_i = __pyx_t_6;
+
+    /* "bx/bbi/bigbed_file.pyx":66
+ *             self.sd.min_val[i] = +numpy.inf
+ *         for i in range(summary_size):
+ *             self.sd.max_val[i] = -numpy.inf             # <<<<<<<<<<<<<<
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):
+ */
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); 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_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    if (__Pyx_SetItemInt(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *)__pyx_v_self)->sd->max_val), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  }
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":68
+ *             self.sd.max_val[i] = -numpy.inf
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):             # <<<<<<<<<<<<<<
+ *         # FIXME: Does this really obvious thing actually do what we want?
+ *         #        No... sum_data will end up being the coverage, but min/max/etc are wrong
+ */
+
+static  PyObject *__pyx_f_2bx_3bbi_11bigbed_file_23SummarizingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_SummarizingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  __Pyx_RefNannySetupContext("handle_interval_value");
+
+  /* "bx/bbi/bigbed_file.pyx":71
+ *         # FIXME: Does this really obvious thing actually do what we want?
+ *         #        No... sum_data will end up being the coverage, but min/max/etc are wrong
+ *         self.sd.accumulate_interval_value( s, e, 1 )             # <<<<<<<<<<<<<<
+ * 
+ * cdef class IntervalAccumulatingBlockHandler( BigBedBlockHandler ):
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self->sd), __pyx_n_s_2); 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 = PyLong_FromUnsignedLong(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_e); 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_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_int_1);
+  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1);
+  __Pyx_GIVEREF(__pyx_int_1);
+  __pyx_t_2 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), 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_4)); __pyx_t_4 = 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_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.SummarizingBlockHandler.handle_interval_value");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":78
+ *     Accumulates intervals into a list of intervals with values
+ *     """
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):             # <<<<<<<<<<<<<<
+ *         BigBedBlockHandler.__init__( self, chrom_id, start, end )
+ *         self.intervals = []
+ */
+
+static int __pyx_pf_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_chrom_id;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_start;
+  __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_end;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom_id,&__pyx_n_s__start,&__pyx_n_s__end,0};
+  __Pyx_RefNannySetupContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[3] = {0,0,0};
+    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_n_s__chrom_id);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+      case  2:
+      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
+      if (likely(values[2])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(values[2]); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_chrom_id = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_chrom_id == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_start = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_start == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_end = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_end == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.__init__");
+  __Pyx_RefNannyFinishContext();
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "bx/bbi/bigbed_file.pyx":79
+ *     """
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):
+ *         BigBedBlockHandler.__init__( self, chrom_id, start, end )             # <<<<<<<<<<<<<<
+ *         self.intervals = []
+ * 
+ */
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_2bx_3bbi_11bigbed_file_BigBedBlockHandler)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_chrom_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+  __Pyx_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
+  __Pyx_GIVEREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_2 = 0;
+  __pyx_t_3 = 0;
+  __pyx_t_4 = 0;
+  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __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_5)); __pyx_t_5 = 0;
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+  /* "bx/bbi/bigbed_file.pyx":80
+ *     def __init__( self, bits32 chrom_id, bits32 start, bits32 end ):
+ *         BigBedBlockHandler.__init__( self, chrom_id, start, end )
+ *         self.intervals = []             # <<<<<<<<<<<<<<
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):
+ */
+  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
+  __Pyx_GOTREF(((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals);
+  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals));
+  ((struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *)__pyx_v_self)->intervals = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.__init__");
+  __pyx_r = -1;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":82
+ *         self.intervals = []
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):             # <<<<<<<<<<<<<<
+ *         self.intervals.append( ( s, e, rest ) )
+ * 
+ */
+
+static  PyObject *__pyx_f_2bx_3bbi_11bigbed_file_32IntervalAccumulatingBlockHandler_handle_interval_value(struct __pyx_obj_2bx_3bbi_11bigbed_file_IntervalAccumulatingBlockHandler *__pyx_v_self, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_s, __pyx_t_2bx_3bbi_5types_bits32 __pyx_v_e, PyObject *__pyx_v_rest) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  __Pyx_RefNannySetupContext("handle_interval_value");
+
+  /* "bx/bbi/bigbed_file.pyx":83
+ * 
+ *     cdef handle_interval_value( self, bits32 s, bits32 e, str rest ):
+ *         self.intervals.append( ( s, e, rest ) )             # <<<<<<<<<<<<<<
+ * 
+ * cdef class BigBedFile( BBIFile ):
+ */
+  if (unlikely(__pyx_v_self->intervals == Py_None)) {
+    PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
+  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_s); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_e); 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_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __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_INCREF(((PyObject *)__pyx_v_rest));
+  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_rest));
+  __Pyx_GIVEREF(((PyObject *)__pyx_v_rest));
+  __pyx_t_1 = 0;
+  __pyx_t_2 = 0;
+  __pyx_t_4 = PyList_Append(__pyx_v_self->intervals, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.IntervalAccumulatingBlockHandler.handle_interval_value");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "bx/bbi/bigbed_file.pyx":89
+ *     A "big binary indexed" file whose raw data is in BED format.
+ *     """
+ *     def __init__( self, file=None ):             # <<<<<<<<<<<<<<
+ *         BBIFile.__init__( self, file, big_bed_sig, "bigbed" )
+ * 
+ */
+
+static int __pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_2bx_3bbi_11bigbed_file_10BigBedFile___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_file = 0;
+  int __pyx_r;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file,0};
+  __Pyx_RefNannySetupContext("__init__");
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[1] = {0};
+    values[0] = ((PyObject *)Py_None);
+    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:
+      if (kw_args > 0) {
+        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file);
+        if (value) { values[0] = 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 = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_file = values[0];
+  } else {
+    __pyx_v_file = ((PyObject *)Py_None);
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  1: __pyx_v_file = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("bx.bbi.bigbed_file.BigBedFile.__init__");
+  __Pyx_RefNannyFinishContext();
+  return -1;
+  __pyx_L4_argument_unpacking_done:;
+
+  /* "bx/bbi/bigbed_file.pyx":90
+ *     """
+ *     def __init__( self, file=None ):
+ *         BBIFile.__init__( self, file, big_bed_sig, "bigbed" )             # <<<<<<<<<<<<<<
+ *