/* Generated by Cython 0.19.1 on Tue Jul  9 01:30:10 2013 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#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
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#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 CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#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)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#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_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#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_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
#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_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#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
#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
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER)
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#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

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__MACS2__IO__cParser
#define __PYX_HAVE_API__MACS2__IO__cParser
#include "string.h"
#include "stdio.h"
#include "pythread.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#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) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return u_end - u - 1;
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#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*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (ascii_chars_u == NULL) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
    }
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    default_encoding_c = PyBytes_AS_STRING(default_encoding);
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(sys);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


#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_d;
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[] = {
  "cParser.pyx",
  "numpy.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};

/* "numpy.pxd":724
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5MACS2_2IO_5numpy_int8_t;

/* "numpy.pxd":725
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5MACS2_2IO_5numpy_int16_t;

/* "numpy.pxd":726
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5MACS2_2IO_5numpy_int32_t;

/* "numpy.pxd":727
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5MACS2_2IO_5numpy_int64_t;

/* "numpy.pxd":731
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5MACS2_2IO_5numpy_uint8_t;

/* "numpy.pxd":732
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5MACS2_2IO_5numpy_uint16_t;

/* "numpy.pxd":733
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5MACS2_2IO_5numpy_uint32_t;

/* "numpy.pxd":734
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5MACS2_2IO_5numpy_uint64_t;

/* "numpy.pxd":738
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float16    float16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t
 */
typedef npy_float16 __pyx_t_5MACS2_2IO_5numpy_float16_t;

/* "numpy.pxd":739
 * 
 * ctypedef npy_float16    float16_t
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5MACS2_2IO_5numpy_float32_t;

/* "numpy.pxd":740
 * ctypedef npy_float16    float16_t
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5MACS2_2IO_5numpy_float64_t;

/* "numpy.pxd":749
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5MACS2_2IO_5numpy_int_t;

/* "numpy.pxd":750
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5MACS2_2IO_5numpy_long_t;

/* "numpy.pxd":751
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5MACS2_2IO_5numpy_longlong_t;

/* "numpy.pxd":753
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5MACS2_2IO_5numpy_uint_t;

/* "numpy.pxd":754
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5MACS2_2IO_5numpy_ulong_t;

/* "numpy.pxd":755
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5MACS2_2IO_5numpy_ulonglong_t;

/* "numpy.pxd":757
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5MACS2_2IO_5numpy_intp_t;

/* "numpy.pxd":758
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5MACS2_2IO_5numpy_uintp_t;

/* "numpy.pxd":760
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5MACS2_2IO_5numpy_float_t;

/* "numpy.pxd":761
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5MACS2_2IO_5numpy_double_t;

/* "numpy.pxd":762
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5MACS2_2IO_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 ---*/
struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser;
struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser;
struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser;
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser;
struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser;
struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser;
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser;
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser;
struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser;
struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser;

/* "numpy.pxd":764
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5MACS2_2IO_5numpy_cfloat_t;

/* "numpy.pxd":765
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5MACS2_2IO_5numpy_cdouble_t;

/* "numpy.pxd":766
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5MACS2_2IO_5numpy_clongdouble_t;

/* "numpy.pxd":768
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5MACS2_2IO_5numpy_complex_t;
struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed;

/* "MACS2/IO/cParser.pyx":1274
 *         return ret
 * 
 * cdef struct _BAMPEParsed:             # <<<<<<<<<<<<<<
 *     int ref
 *     int start
 */
struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed {
  int ref;
  int start;
  int tlen;
};

/* "MACS2/IO/cParser.pyx":118
 *         return repr( "Strand information can not be recognized in this line: \"%s\",\"%s\"" % ( self.string, self.strand ) )
 * 
 * cdef class GenericParser:             # <<<<<<<<<<<<<<
 *     """Generic Parser class.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser {
  PyObject_HEAD
  PyObject *filename;
  PyBoolObject *gzipped;
  int tag_size;
  PyObject *fhd;
};


/* "MACS2/IO/cParser.pyx":296
 *         self.fhd.close()
 * 
 * cdef class BEDParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for tabular File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};


/* "MACS2/IO/cParser.pyx":1365
 *                 raise StrandFormatError( thisline, thisfields[ 1 ] )
 * 
 * cdef class PySAMParser:             # <<<<<<<<<<<<<<
 *     """Parser using PySAM to parse SAM or BAM
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser {
  PyObject_HEAD
  PyObject *filename;
  PyBoolObject *gzipped;
  int tag_size;
  PyObject *fhd;
};


/* "MACS2/IO/cParser.pyx":351
 * 
 * 
 * cdef class ELANDResultParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for tabular File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};


/* "MACS2/IO/cParser.pyx":623
 *         return ( thisref, thisstart, thisstrand )
 * 
 * cdef class BAMParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for BAM File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
  struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *__pyx_vtab;
};


/* "MACS2/IO/cParser.pyx":1018
 *         return ( thisref, thisstart, thisstrand )
 * 
 * cdef class BAMPEParser(BAMParser):             # <<<<<<<<<<<<<<
 *     """File Parser Class for BAM File containing paired-end reads
 *     Only counts valid pairs, discards everything else
 */
struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser __pyx_base;
  int n;
  int d;
};


/* "MACS2/IO/cParser.pyx":403
 *             return ( "", -1, -1 )
 * 
 * cdef class ELANDMultiParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for ELAND multi File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};


/* "MACS2/IO/cParser.pyx":476
 * 
 * 
 * cdef class ELANDExportParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for ELAND Export File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};


/* "MACS2/IO/cParser.pyx":519
 * 
 * ### Contributed by Davide, modified by Tao
 * cdef class SAMParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for SAM File.
 * 
 */
struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};


/* "MACS2/IO/cParser.pyx":1281
 * ### End ###
 * 
 * cdef class BowtieParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for map files from Bowtie or MAQ's maqview
 *     program.
 */
struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser __pyx_base;
};



/* "MACS2/IO/cParser.pyx":623
 *         return ( thisref, thisstart, thisstrand )
 * 
 * cdef class BAMParser( GenericParser ):             # <<<<<<<<<<<<<<
 *     """File Parser Class for BAM File.
 * 
 */

struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser {
  int (*tsize)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch);
  int (*__pyx___tsize_w_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  int (*__pyx___tsize_wo_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  PyObject *(*get_references)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch);
  PyObject *(*__pyx___get_references_w_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  PyObject *(*__pyx___get_references_wo_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  PyObject *(*build_fwtrack)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch);
  PyObject *(*__pyx___build_fwtrack_w_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  PyObject *(*__pyx___build_fwtrack_wo_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *);
  PyObject *(*append_fwtrack)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *, int __pyx_skip_dispatch);
  PyObject *(*__pyx___append_fwtrack_w_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *);
  PyObject *(*__pyx___append_fwtrack_wo_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *);
  PyObject *(*__pyx___fw_binary_parse)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *__pyx_vtabptr_5MACS2_2IO_7cParser_BAMParser;


/* "MACS2/IO/cParser.pyx":1018
 *         return ( thisref, thisstart, thisstrand )
 * 
 * cdef class BAMPEParser(BAMParser):             # <<<<<<<<<<<<<<
 *     """File Parser Class for BAM File containing paired-end reads
 *     Only counts valid pairs, discards everything else
 */

struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser {
  struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser __pyx_base;
  PyObject *(*build_petrack)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, int __pyx_skip_dispatch);
  PyObject *(*__pyx___build_petrack_w_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *);
  PyObject *(*__pyx___build_petrack_wo_pysam)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *);
  PyObject *(*append_petrack)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, PyObject *, int __pyx_skip_dispatch);
  struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed (*__pyx___pe_binary_parse)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, char *);
};
static struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *__pyx_vtabptr_5MACS2_2IO_7cParser_BAMPEParser;
#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); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #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_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #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_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*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, PyObject *cause); /*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*/

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

#define UNARY_NEG_WOULD_OVERFLOW(x)            (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename); /*proto*/

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static CYTHON_INLINE unsigned int __Pyx_abs_int(int x) {
    if (unlikely(x == -INT_MAX-1))
        return ((unsigned int)INT_MAX) + 1U;
    return (unsigned int) abs(x);
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f) \
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
    int flags;
    PyObject *func_dict;
    PyObject *func_weakreflist;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj; /* No-args super() class cell */
    void *defaults;
    int defaults_pyobjects;
    PyObject *defaults_tuple;   /* Const defaults tuple */
    PyObject *defaults_kwdict;  /* Const kwonly defaults dict */
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations; /* function annotations dict */
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self, PyObject *module,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __Pyx_CyFunction_init(void);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *qualname, PyObject *modname); /*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 CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/

static int __Pyx_check_binary_version(void);

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.module' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.tuple' */

/* Module declarations from 'cpython.list' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.sequence' */

/* Module declarations from 'cpython.mapping' */

/* Module declarations from 'cpython.iterator' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython.number' */

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

/* Module declarations from 'cpython.long' */

/* Module declarations from 'cpython.float' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

/* Module declarations from 'cpython.string' */

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'cpython.dict' */

/* Module declarations from 'cpython.instance' */

/* Module declarations from 'cpython.function' */

/* Module declarations from 'cpython.method' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.getargs' */

/* Module declarations from 'cpython.pythread' */

/* Module declarations from 'cpython.pystate' */

/* Module declarations from 'cpython.cobject' */

/* Module declarations from 'cpython.oldbuffer' */

/* Module declarations from 'cpython.set' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'cpython.bytes' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cpython' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'numpy' */

/* Module declarations from 'MACS2.IO.numpy' */
static PyTypeObject *__pyx_ptype_5MACS2_2IO_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5MACS2_2IO_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'MACS2.IO.cParser' */
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_GenericParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_BEDParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_PySAMParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_ELANDResultParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_BAMParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_BAMPEParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_ELANDMultiParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_ELANDExportParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_SAMParser = 0;
static PyTypeObject *__pyx_ptype_5MACS2_2IO_7cParser_BowtieParser = 0;
__PYX_EXTERN_C DL_EXPORT(int) HAS_PYSAM;
static PyObject *__pyx_f_5MACS2_2IO_7cParser_guess_parser(PyObject *, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "MACS2.IO.cParser"
int __pyx_module_is_main_MACS2__IO__cParser = 0;

/* Implementation of 'MACS2.IO.cParser' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_guess_parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fhd); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_strand); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_5MACS2_2IO_7cParser_13GenericParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_2tsize(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_4__tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_6build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_8append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, PyObject *__pyx_v_fwtrack); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_10__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_12sniff(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_14close(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BEDParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BEDParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9SAMParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9SAMParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static int __pyx_pf_5MACS2_2IO_7cParser_9BAMParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_2sniff(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_4tsize(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_6get_references(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_8build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_10append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_12__fw_binary_parse(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_build_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_2append_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_petrack); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n___get__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self); /* proto */
static int __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n_2__set__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d___get__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self); /* proto */
static int __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d_2__set__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_12BowtieParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_12BowtieParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *__pyx_v_self, PyObject *__pyx_v_thisline); /* proto */
static int __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_2tsize(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_4__tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_6build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_8append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_10__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_12sniff(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_14close(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self); /* proto */
static int __pyx_pf_5MACS2_2IO_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5MACS2_2IO_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BEDParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_PySAMParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDResultParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BAMParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BAMPEParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDMultiParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDExportParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_SAMParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BowtieParser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_2[] = "Detected format is: %s";
static char __pyx_k_3[] = "* Input file is gzipped.";
static char __pyx_k_5[] = "Can't detect format!";
static char __pyx_k_7[] = "Strand information can not be recognized in this line: \"%s\",\"%s\"";
static char __pyx_k_10[] = " %d";
static char __pyx_k_11[] = "";
static char __pyx_k_15[] = "#";
static char __pyx_k_16[] = "\t";
static char __pyx_k_20[] = "+";
static char __pyx_k_21[] = "-";
static char __pyx_k_26[] = ".fa";
static char __pyx_k_34[] = ":";
static char __pyx_k_43[] = "@";
static char __pyx_k_57[] = "File is not of a valid BAM format! %d";
static char __pyx_k_60[] = "<i";
static char __pyx_k_78[] = "<hh";
static char __pyx_k_87[] = "Something went wrong (mean fragment size was negative)";
static char __pyx_k__B[] = "B";
static char __pyx_k__F[] = "F";
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__R[] = "R";
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_102[] = "ndarray is not C contiguous";
static char __pyx_k_104[] = "ndarray is not Fortran contiguous";
static char __pyx_k_106[] = "Non-native byte order not supported";
static char __pyx_k_108[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_109[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_112[] = "Format string allocated too short.";
static char __pyx_k_114[] = "Module for all MACS Parser classes for input.\n\nCopyright (c) 2010,2011 Tao Liu <taoliu@jimmy.harvard.edu>\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the Artistic License (see the file COPYING included\nwith the distribution).\n\n@status:  experimental\n@version: $Revision$\n@author:  Tao Liu\n@contact: taoliu@jimmy.harvard.edu\n";
static char __pyx_k_115[] = "MACS2.Constants";
static char __pyx_k_116[] = "*";
static char __pyx_k_117[] = "MACS2.IO.cFixWidthTrack";
static char __pyx_k_118[] = "MACS2.IO.cPairedEndTrack";
static char __pyx_k_119[] = "Parser $Revision$";
static char __pyx_k_120[] = "Tao Liu <taoliu@jimmy.harvard.edu>";
static char __pyx_k_121[] = "All Parser classes";
static char __pyx_k_124[] = "/Users/taoliu/Dropbox-UB/Dropbox/Projects/MACS2/MACS/MACS2/IO/cParser.pyx";
static char __pyx_k_125[] = "StrandFormatError.__init__";
static char __pyx_k_126[] = "MACS2.IO.cParser";
static char __pyx_k_129[] = "StrandFormatError.__str__";
static char __pyx_k_130[] = "Exception about strand format error.\n\n    Example:\n    raise StrandFormatError('Must be F or R','X')\n    ";
static char __pyx_k__U0[] = "U0";
static char __pyx_k__U1[] = "U1";
static char __pyx_k__U2[] = "U2";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__io[] = "io";
static char __pyx_k__np[] = "np";
static char __pyx_k__rb[] = "rb";
static char __pyx_k__BAM[] = "BAM";
static char __pyx_k__BED[] = "BED";
static char __pyx_k__SAM[] = "SAM";
static char __pyx_k__map[] = "map";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__sum[] = "sum";
static char __pyx_k__tid[] = "tid";
static char __pyx_k__zip[] = "zip";
static char __pyx_k__gzip[] = "gzip";
static char __pyx_k__info[] = "info";
static char __pyx_k__join[] = "join";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__next[] = "next";
static char __pyx_k__open[] = "open";
static char __pyx_k__qlen[] = "qlen";
static char __pyx_k__read[] = "read";
static char __pyx_k__rlen[] = "rlen";
static char __pyx_k__seek[] = "seek";
static char __pyx_k__self[] = "self";
static char __pyx_k__tell[] = "tell";
static char __pyx_k__ELAND[] = "ELAND";
static char __pyx_k__close[] = "close";
static char __pyx_k__error[] = "error";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__pysam[] = "pysam";
static char __pyx_k__range[] = "range";
static char __pyx_k__reset[] = "reset";
static char __pyx_k__sniff[] = "sniff";
static char __pyx_k__split[] = "split";
static char __pyx_k__track[] = "track";
static char __pyx_k__tsize[] = "tsize";
static char __pyx_k__BOWTIE[] = "BOWTIE";
static char __pyx_k__rindex[] = "rindex";
static char __pyx_k__rstrip[] = "rstrip";
static char __pyx_k__strand[] = "strand";
static char __pyx_k__string[] = "string";
static char __pyx_k__struct[] = "struct";
static char __pyx_k__unpack[] = "unpack";
static char __pyx_k__IOError[] = "IOError";
static char __pyx_k__Samfile[] = "Samfile";
static char __pyx_k____doc__[] = "__doc__";
static char __pyx_k____str__[] = "__str__";
static char __pyx_k__add_loc[] = "add_loc";
static char __pyx_k__browser[] = "browser";
static char __pyx_k__isdigit[] = "isdigit";
static char __pyx_k__lengths[] = "lengths";
static char __pyx_k__logging[] = "logging";
static char __pyx_k__PETrackI[] = "PETrackI";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__filename[] = "filename";
static char __pyx_k__finalize[] = "finalize";
static char __pyx_k__is_read2[] = "is_read2";
static char __pyx_k__readline[] = "readline";
static char __pyx_k__rlengths[] = "rlengths";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__is_paired[] = "is_paired";
static char __pyx_k__ELANDMULTI[] = "ELANDMULTI";
static char __pyx_k__FWTrackIII[] = "FWTrackIII";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k____author__[] = "__author__";
static char __pyx_k____import__[] = "__import__";
static char __pyx_k____module__[] = "__module__";
static char __pyx_k__is_reverse[] = "is_reverse";
static char __pyx_k__references[] = "references";
static char __pyx_k__ELANDEXPORT[] = "ELANDEXPORT";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k__is_unmapped[] = "is_unmapped";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k____qualname__[] = "__qualname__";
static char __pyx_k__set_rlengths[] = "set_rlengths";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k____metaclass__[] = "__metaclass__";
static char __pyx_k__build_fwtrack[] = "build_fwtrack";
static char __pyx_k__build_petrack[] = "build_petrack";
static char __pyx_k__BufferedReader[] = "BufferedReader";
static char __pyx_k__NotImplemented[] = "NotImplemented";
static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
static char __pyx_k__append_fwtrack[] = "append_fwtrack";
static char __pyx_k__append_petrack[] = "append_petrack";
static char __pyx_k__get_references[] = "get_references";
static char __pyx_k__is_proper_pair[] = "is_proper_pair";
static char __pyx_k____fw_parse_line[] = "__fw_parse_line";
static char __pyx_k__StrandFormatError[] = "StrandFormatError";
static char __pyx_k____fw_binary_parse[] = "__fw_binary_parse";
static char __pyx_k____tlen_parse_line[] = "__tlen_parse_line";
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_u_102;
static PyObject *__pyx_kp_u_104;
static PyObject *__pyx_kp_u_106;
static PyObject *__pyx_kp_u_108;
static PyObject *__pyx_kp_u_109;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_u_112;
static PyObject *__pyx_n_s_115;
static PyObject *__pyx_n_s_116;
static PyObject *__pyx_n_s_117;
static PyObject *__pyx_n_s_118;
static PyObject *__pyx_kp_s_119;
static PyObject *__pyx_kp_s_120;
static PyObject *__pyx_kp_s_121;
static PyObject *__pyx_kp_s_124;
static PyObject *__pyx_n_s_125;
static PyObject *__pyx_n_s_126;
static PyObject *__pyx_n_s_129;
static PyObject *__pyx_kp_s_130;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_43;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_57;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_78;
static PyObject *__pyx_kp_s_87;
static PyObject *__pyx_n_s__BAM;
static PyObject *__pyx_n_s__BED;
static PyObject *__pyx_n_s__BOWTIE;
static PyObject *__pyx_n_s__BufferedReader;
static PyObject *__pyx_n_s__ELAND;
static PyObject *__pyx_n_s__ELANDEXPORT;
static PyObject *__pyx_n_s__ELANDMULTI;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__F;
static PyObject *__pyx_n_s__FWTrackIII;
static PyObject *__pyx_n_s__IOError;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__NotImplemented;
static PyObject *__pyx_n_s__PETrackI;
static PyObject *__pyx_n_s__R;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__SAM;
static PyObject *__pyx_n_s__Samfile;
static PyObject *__pyx_n_s__StopIteration;
static PyObject *__pyx_n_s__StrandFormatError;
static PyObject *__pyx_n_s__U0;
static PyObject *__pyx_n_s__U1;
static PyObject *__pyx_n_s__U2;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____author__;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____doc__;
static PyObject *__pyx_n_s____fw_binary_parse;
static PyObject *__pyx_n_s____fw_parse_line;
static PyObject *__pyx_n_s____import__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____metaclass__;
static PyObject *__pyx_n_s____module__;
static PyObject *__pyx_n_s____pyx_vtable__;
static PyObject *__pyx_n_s____qualname__;
static PyObject *__pyx_n_s____str__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____tlen_parse_line;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s__add_loc;
static PyObject *__pyx_n_s__append_fwtrack;
static PyObject *__pyx_n_s__append_petrack;
static PyObject *__pyx_n_s__browser;
static PyObject *__pyx_n_s__build_fwtrack;
static PyObject *__pyx_n_s__build_petrack;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__finalize;
static PyObject *__pyx_n_s__get_references;
static PyObject *__pyx_n_s__gzip;
static PyObject *__pyx_n_s__info;
static PyObject *__pyx_n_s__io;
static PyObject *__pyx_n_s__is_paired;
static PyObject *__pyx_n_s__is_proper_pair;
static PyObject *__pyx_n_s__is_read2;
static PyObject *__pyx_n_s__is_reverse;
static PyObject *__pyx_n_s__is_unmapped;
static PyObject *__pyx_n_s__isdigit;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__lengths;
static PyObject *__pyx_n_s__logging;
static PyObject *__pyx_n_s__map;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__open;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__pysam;
static PyObject *__pyx_n_s__qlen;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__rb;
static PyObject *__pyx_n_s__read;
static PyObject *__pyx_n_s__readline;
static PyObject *__pyx_n_s__references;
static PyObject *__pyx_n_s__reset;
static PyObject *__pyx_n_s__rindex;
static PyObject *__pyx_n_s__rlen;
static PyObject *__pyx_n_s__rlengths;
static PyObject *__pyx_n_s__rstrip;
static PyObject *__pyx_n_s__seek;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__set_rlengths;
static PyObject *__pyx_n_s__sniff;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__strand;
static PyObject *__pyx_n_s__string;
static PyObject *__pyx_n_s__struct;
static PyObject *__pyx_n_s__sum;
static PyObject *__pyx_n_s__tell;
static PyObject *__pyx_n_s__tid;
static PyObject *__pyx_n_s__track;
static PyObject *__pyx_n_s__tsize;
static PyObject *__pyx_n_s__unpack;
static PyObject *__pyx_n_s__zip;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_12;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_1000000;
static PyObject *__pyx_k_tuple_1;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_slice_65;
static PyObject *__pyx_k_slice_71;
static PyObject *__pyx_k_slice_76;
static PyObject *__pyx_k_slice_77;
static PyObject *__pyx_k_slice_79;
static PyObject *__pyx_k_slice_84;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_13;
static PyObject *__pyx_k_tuple_14;
static PyObject *__pyx_k_tuple_17;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_27;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_30;
static PyObject *__pyx_k_tuple_31;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_33;
static PyObject *__pyx_k_tuple_35;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_37;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_39;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_41;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_tuple_44;
static PyObject *__pyx_k_tuple_45;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_tuple_47;
static PyObject *__pyx_k_tuple_48;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_51;
static PyObject *__pyx_k_tuple_52;
static PyObject *__pyx_k_tuple_53;
static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_56;
static PyObject *__pyx_k_tuple_58;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_63;
static PyObject *__pyx_k_tuple_64;
static PyObject *__pyx_k_tuple_66;
static PyObject *__pyx_k_tuple_67;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_tuple_69;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_72;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_74;
static PyObject *__pyx_k_tuple_75;
static PyObject *__pyx_k_tuple_80;
static PyObject *__pyx_k_tuple_81;
static PyObject *__pyx_k_tuple_82;
static PyObject *__pyx_k_tuple_83;
static PyObject *__pyx_k_tuple_85;
static PyObject *__pyx_k_tuple_86;
static PyObject *__pyx_k_tuple_88;
static PyObject *__pyx_k_tuple_89;
static PyObject *__pyx_k_tuple_90;
static PyObject *__pyx_k_tuple_91;
static PyObject *__pyx_k_tuple_92;
static PyObject *__pyx_k_tuple_93;
static PyObject *__pyx_k_tuple_94;
static PyObject *__pyx_k_tuple_95;
static PyObject *__pyx_k_tuple_96;
static PyObject *__pyx_k_tuple_97;
static PyObject *__pyx_k_tuple_98;
static PyObject *__pyx_k_tuple_99;
static PyObject *__pyx_k_tuple_100;
static PyObject *__pyx_k_tuple_101;
static PyObject *__pyx_k_tuple_103;
static PyObject *__pyx_k_tuple_105;
static PyObject *__pyx_k_tuple_107;
static PyObject *__pyx_k_tuple_110;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_113;
static PyObject *__pyx_k_tuple_122;
static PyObject *__pyx_k_tuple_127;
static PyObject *__pyx_k_codeobj_123;
static PyObject *__pyx_k_codeobj_128;
int HAS_PYSAM;

/* "MACS2/IO/cParser.pyx":67
 * # ------------------------------------
 * 
 * cpdef guess_parser ( fhd ):             # <<<<<<<<<<<<<<
 *     order_list = ("BAM",
 *                   "BED",
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_1guess_parser(PyObject *__pyx_self, PyObject *__pyx_v_fhd); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_guess_parser(PyObject *__pyx_v_fhd, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_order_list = NULL;
  PyObject *__pyx_v_f = NULL;
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_p = NULL;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("guess_parser", 0);

  /* "MACS2/IO/cParser.pyx":68
 * 
 * cpdef guess_parser ( fhd ):
 *     order_list = ("BAM",             # <<<<<<<<<<<<<<
 *                   "BED",
 *                   "ELAND",
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_1));
  __pyx_v_order_list = __pyx_k_tuple_1;

  /* "MACS2/IO/cParser.pyx":77
 *                   )
 * 
 *     for f in order_list:             # <<<<<<<<<<<<<<
 *         if f == 'BED':
 *             p = BEDParser( fhd )
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_order_list); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF(__pyx_v_f);
    __pyx_v_f = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":78
 * 
 *     for f in order_list:
 *         if f == 'BED':             # <<<<<<<<<<<<<<
 *             p = BEDParser( fhd )
 *         elif f == "ELAND":
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__BED), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":79
 *     for f in order_list:
 *         if f == 'BED':
 *             p = BEDParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f == "ELAND":
 *             p = ELANDResultParser( fhd )
 */
      __pyx_t_3 = PyTuple_New(1); 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_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_BEDParser)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":80
 *         if f == 'BED':
 *             p = BEDParser( fhd )
 *         elif f == "ELAND":             # <<<<<<<<<<<<<<
 *             p = ELANDResultParser( fhd )
 *         elif f ==  "ELANDMULTI":
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__ELAND), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":81
 *             p = BEDParser( fhd )
 *         elif f == "ELAND":
 *             p = ELANDResultParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f ==  "ELANDMULTI":
 *             p = ELANDMultiParser( fhd )
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_ELANDResultParser)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":82
 *         elif f == "ELAND":
 *             p = ELANDResultParser( fhd )
 *         elif f ==  "ELANDMULTI":             # <<<<<<<<<<<<<<
 *             p = ELANDMultiParser( fhd )
 *         elif f == "ELANDEXPORT":
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__ELANDMULTI), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":83
 *             p = ELANDResultParser( fhd )
 *         elif f ==  "ELANDMULTI":
 *             p = ELANDMultiParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f == "ELANDEXPORT":
 *             p = ELANDExportParser( fhd )
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_ELANDMultiParser)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":84
 *         elif f ==  "ELANDMULTI":
 *             p = ELANDMultiParser( fhd )
 *         elif f == "ELANDEXPORT":             # <<<<<<<<<<<<<<
 *             p = ELANDExportParser( fhd )
 *         elif f == "SAM":
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__ELANDEXPORT), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":85
 *             p = ELANDMultiParser( fhd )
 *         elif f == "ELANDEXPORT":
 *             p = ELANDExportParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f == "SAM":
 *             p = SAMParser( fhd )
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_ELANDExportParser)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":86
 *         elif f == "ELANDEXPORT":
 *             p = ELANDExportParser( fhd )
 *         elif f == "SAM":             # <<<<<<<<<<<<<<
 *             p = SAMParser( fhd )
 *         elif f == "BAM":
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__SAM), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":87
 *             p = ELANDExportParser( fhd )
 *         elif f == "SAM":
 *             p = SAMParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f == "BAM":
 *             p = BAMParser( fhd )
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_SAMParser)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":88
 *         elif f == "SAM":
 *             p = SAMParser( fhd )
 *         elif f == "BAM":             # <<<<<<<<<<<<<<
 *             p = BAMParser( fhd )
 *         elif f == "BOWTIE":
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__BAM), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":89
 *             p = SAMParser( fhd )
 *         elif f == "BAM":
 *             p = BAMParser( fhd )             # <<<<<<<<<<<<<<
 *         elif f == "BOWTIE":
 *             p = BowtieParser( fhd )
 */
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_BAMParser)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":90
 *         elif f == "BAM":
 *             p = BAMParser( fhd )
 *         elif f == "BOWTIE":             # <<<<<<<<<<<<<<
 *             p = BowtieParser( fhd )
 *         s = p.sniff()
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_f, ((PyObject *)__pyx_n_s__BOWTIE), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":91
 *             p = BAMParser( fhd )
 *         elif f == "BOWTIE":
 *             p = BowtieParser( fhd )             # <<<<<<<<<<<<<<
 *         s = p.sniff()
 *         if s:
 */
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_fhd);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fhd);
      __Pyx_GIVEREF(__pyx_v_fhd);
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5MACS2_2IO_7cParser_BowtieParser)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_p));
      __pyx_v_p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "MACS2/IO/cParser.pyx":92
 *         elif f == "BOWTIE":
 *             p = BowtieParser( fhd )
 *         s = p.sniff()             # <<<<<<<<<<<<<<
 *         if s:
 *             logging.info( "Detected format is: %s" % ( f ) )
 */
    if (unlikely(!__pyx_v_p)) { __Pyx_RaiseUnboundLocalError("p"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_p), __pyx_n_s__sniff); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_s);
    __pyx_v_s = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":93
 *             p = BowtieParser( fhd )
 *         s = p.sniff()
 *         if s:             # <<<<<<<<<<<<<<
 *             logging.info( "Detected format is: %s" % ( f ) )
 *             if p.gzipped:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":94
 *         s = p.sniff()
 *         if s:
 *             logging.info( "Detected format is: %s" % ( f ) )             # <<<<<<<<<<<<<<
 *             if p.gzipped:
 *                 logging.info( "* Input file is gzipped." )
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_f); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":95
 *         if s:
 *             logging.info( "Detected format is: %s" % ( f ) )
 *             if p.gzipped:             # <<<<<<<<<<<<<<
 *                 logging.info( "* Input file is gzipped." )
 *             return p
 */
      __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_p->gzipped)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "MACS2/IO/cParser.pyx":96
 *             logging.info( "Detected format is: %s" % ( f ) )
 *             if p.gzipped:
 *                 logging.info( "* Input file is gzipped." )             # <<<<<<<<<<<<<<
 *             return p
 *         else:
 */
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "MACS2/IO/cParser.pyx":97
 *             if p.gzipped:
 *                 logging.info( "* Input file is gzipped." )
 *             return p             # <<<<<<<<<<<<<<
 *         else:
 *             p.close()
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_p));
      __pyx_r = ((PyObject *)__pyx_v_p);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":99
 *             return p
 *         else:
 *             p.close()             # <<<<<<<<<<<<<<
 *     raise Exception( "Can't detect format!" )
 * 
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_p), __pyx_n_s__close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L6:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":100
 *         else:
 *             p.close()
 *     raise Exception( "Can't detect format!" )             # <<<<<<<<<<<<<<
 * 
 * # ------------------------------------
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("MACS2.IO.cParser.guess_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_order_list);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_1guess_parser(PyObject *__pyx_self, PyObject *__pyx_v_fhd); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_1guess_parser(PyObject *__pyx_self, PyObject *__pyx_v_fhd) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("guess_parser (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_guess_parser(__pyx_self, ((PyObject *)__pyx_v_fhd));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":67
 * # ------------------------------------
 * 
 * cpdef guess_parser ( fhd ):             # <<<<<<<<<<<<<<
 *     order_list = ("BAM",
 *                   "BED",
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_guess_parser(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fhd) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("guess_parser", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5MACS2_2IO_7cParser_guess_parser(__pyx_v_fhd, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.guess_parser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5MACS2_2IO_7cParser_17StrandFormatError_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_string = 0;
  PyObject *__pyx_v_strand = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__string,&__pyx_n_s__strand,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_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;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_string = values[1];
    __pyx_v_strand = values[2];
  }
  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 = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.StrandFormatError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError___init__(__pyx_self, __pyx_v_self, __pyx_v_string, __pyx_v_strand);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":111
 *     raise StrandFormatError('Must be F or R','X')
 *     """
 *     def __init__ ( self, string, strand ):             # <<<<<<<<<<<<<<
 *         self.strand = strand
 *         self.string = string
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_string, PyObject *__pyx_v_strand) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "MACS2/IO/cParser.pyx":112
 *     """
 *     def __init__ ( self, string, strand ):
 *         self.strand = strand             # <<<<<<<<<<<<<<
 *         self.string = string
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__strand, __pyx_v_strand) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "MACS2/IO/cParser.pyx":113
 *     def __init__ ( self, string, strand ):
 *         self.strand = strand
 *         self.string = string             # <<<<<<<<<<<<<<
 * 
 *     def __str__ ( self ):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__string, __pyx_v_string) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.StrandFormatError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5MACS2_2IO_7cParser_17StrandFormatError_3__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_3__str__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17StrandFormatError_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":115
 *         self.string = string
 * 
 *     def __str__ ( self ):             # <<<<<<<<<<<<<<
 *         return repr( "Strand information can not be recognized in this line: \"%s\",\"%s\"" % ( self.string, self.strand ) )
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17StrandFormatError_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "MACS2/IO/cParser.pyx":116
 * 
 *     def __str__ ( self ):
 *         return repr( "Strand information can not be recognized in this line: \"%s\",\"%s\"" % ( self.string, self.strand ) )             # <<<<<<<<<<<<<<
 * 
 * cdef class GenericParser:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__string); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("MACS2.IO.cParser.StrandFormatError.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser___init__[] = "Open input file. Determine whether it's a gzipped file.\n\n        'filename' must be a string object.\n\n        This function initialize the following attributes:\n\n        1. self.filename: the filename for input file.\n        2. self.gzipped: a boolean indicating whether input file is gzipped.\n        3. self.fhd: buffered I/O stream of input file\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_5MACS2_2IO_7cParser_13GenericParser___init__;
#endif
static int __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser___init__(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self), __pyx_v_filename);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":131
 *     cdef object fhd
 * 
 *     def __init__ ( self, str filename ):             # <<<<<<<<<<<<<<
 *         """Open input file. Determine whether it's a gzipped file.
 * 
 */

static int __pyx_pf_5MACS2_2IO_7cParser_13GenericParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_f = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "MACS2/IO/cParser.pyx":142
 *         3. self.fhd: buffered I/O stream of input file
 *         """
 *         self.filename = filename             # <<<<<<<<<<<<<<
 *         self.gzipped = True
 *         self.tag_size = -1
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_filename));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
  __Pyx_GOTREF(__pyx_v_self->filename);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->filename));
  __pyx_v_self->filename = __pyx_v_filename;

  /* "MACS2/IO/cParser.pyx":143
 *         """
 *         self.filename = filename
 *         self.gzipped = True             # <<<<<<<<<<<<<<
 *         self.tag_size = -1
 *         # try gzip first
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gzipped);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gzipped));
  __pyx_v_self->gzipped = ((PyBoolObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":144
 *         self.filename = filename
 *         self.gzipped = True
 *         self.tag_size = -1             # <<<<<<<<<<<<<<
 *         # try gzip first
 *         f = gzip.open( filename )
 */
  __pyx_v_self->tag_size = -1;

  /* "MACS2/IO/cParser.pyx":146
 *         self.tag_size = -1
 *         # try gzip first
 *         f = gzip.open( filename )             # <<<<<<<<<<<<<<
 *         try:
 *             f.read( 10 )
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_filename));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filename));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_f = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":147
 *         # try gzip first
 *         f = gzip.open( filename )
 *         try:             # <<<<<<<<<<<<<<
 *             f.read( 10 )
 *         except IOError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":148
 *         f = gzip.open( filename )
 *         try:
 *             f.read( 10 )             # <<<<<<<<<<<<<<
 *         except IOError:
 *             # not a gzipped file
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":149
 *         try:
 *             f.read( 10 )
 *         except IOError:             # <<<<<<<<<<<<<<
 *             # not a gzipped file
 *             self.gzipped = False
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_IOError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "MACS2/IO/cParser.pyx":151
 *         except IOError:
 *             # not a gzipped file
 *             self.gzipped = False             # <<<<<<<<<<<<<<
 *         f.close()
 *         if self.gzipped:
 */
      __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_v_self->gzipped);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->gzipped));
      __pyx_v_self->gzipped = ((PyBoolObject *)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L10_try_end:;
  }

  /* "MACS2/IO/cParser.pyx":152
 *             # not a gzipped file
 *             self.gzipped = False
 *         f.close()             # <<<<<<<<<<<<<<
 *         if self.gzipped:
 *             # open with gzip.open, then wrap it with BufferedReader!
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":153
 *             self.gzipped = False
 *         f.close()
 *         if self.gzipped:             # <<<<<<<<<<<<<<
 *             # open with gzip.open, then wrap it with BufferedReader!
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->gzipped)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_9) {

    /* "MACS2/IO/cParser.pyx":155
 *         if self.gzipped:
 *             # open with gzip.open, then wrap it with BufferedReader!
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__BufferedReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_10);
    __Pyx_GOTREF(__pyx_v_self->fhd);
    __Pyx_DECREF(__pyx_v_self->fhd);
    __pyx_v_self->fhd = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":157
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 *         else:
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!             # <<<<<<<<<<<<<<
 * 
 *     def tsize( self ):
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__open); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->fhd);
    __Pyx_DECREF(__pyx_v_self->fhd);
    __pyx_v_self->fhd = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L13:;

  __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_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_3tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_2tsize[] = "General function to detect tag size.\n\n        * Although it can be used by most parsers, it must be\n          rewritten by BAMParser!\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_3tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_2tsize(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":159
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 * 
 *     def tsize( self ):             # <<<<<<<<<<<<<<
 *         """General function to detect tag size.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_2tsize(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self) {
  int __pyx_v_s;
  int __pyx_v_n;
  int __pyx_v_m;
  int __pyx_v_this_taglength;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tsize", 0);

  /* "MACS2/IO/cParser.pyx":166
 *         """
 *         cdef:
 *             int s = 0             # <<<<<<<<<<<<<<
 *             int n = 0     # number of successful/valid read alignments
 *             int m = 0     # number of trials
 */
  __pyx_v_s = 0;

  /* "MACS2/IO/cParser.pyx":167
 *         cdef:
 *             int s = 0
 *             int n = 0     # number of successful/valid read alignments             # <<<<<<<<<<<<<<
 *             int m = 0     # number of trials
 *             int this_taglength
 */
  __pyx_v_n = 0;

  /* "MACS2/IO/cParser.pyx":168
 *             int s = 0
 *             int n = 0     # number of successful/valid read alignments
 *             int m = 0     # number of trials             # <<<<<<<<<<<<<<
 *             int this_taglength
 * 
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":171
 *             int this_taglength
 * 
 *         if self.tag_size != -1:             # <<<<<<<<<<<<<<
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size
 */
  __pyx_t_1 = ((__pyx_v_self->tag_size != -1) != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":173
 *         if self.tag_size != -1:
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *         # try 10k times or retrieve 10 successfule alignments
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tag_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":176
 * 
 *         # try 10k times or retrieve 10 successfule alignments
 *         while n < 10 and m < 10000:             # <<<<<<<<<<<<<<
 *             m += 1
 *             thisline = self.fhd.readline()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_n < 10) != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_m < 10000) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (!__pyx_t_4) break;

    /* "MACS2/IO/cParser.pyx":177
 *         # try 10k times or retrieve 10 successfule alignments
 *         while n < 10 and m < 10000:
 *             m += 1             # <<<<<<<<<<<<<<
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )
 */
    __pyx_v_m = (__pyx_v_m + 1);

    /* "MACS2/IO/cParser.pyx":178
 *         while n < 10 and m < 10000:
 *             m += 1
 *             thisline = self.fhd.readline()             # <<<<<<<<<<<<<<
 *             this_taglength = self.__tlen_parse_line( thisline )
 *             if this_taglength > 0:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "MACS2/IO/cParser.pyx":179
 *             m += 1
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             if this_taglength > 0:
 *                 # this_taglength == 0 means this line doesn't contain
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____tlen_parse_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_this_taglength = __pyx_t_7;

    /* "MACS2/IO/cParser.pyx":180
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )
 *             if this_taglength > 0:             # <<<<<<<<<<<<<<
 *                 # this_taglength == 0 means this line doesn't contain
 *                 # successful alignment.
 */
    __pyx_t_4 = ((__pyx_v_this_taglength > 0) != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":183
 *                 # this_taglength == 0 means this line doesn't contain
 *                 # successful alignment.
 *                 s += this_taglength             # <<<<<<<<<<<<<<
 *                 n += 1
 *         # done
 */
      __pyx_v_s = (__pyx_v_s + __pyx_v_this_taglength);

      /* "MACS2/IO/cParser.pyx":184
 *                 # successful alignment.
 *                 s += this_taglength
 *                 n += 1             # <<<<<<<<<<<<<<
 *         # done
 *         self.fhd.seek( 0 )
 */
      __pyx_v_n = (__pyx_v_n + 1);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "MACS2/IO/cParser.pyx":186
 *                 n += 1
 *         # done
 *         self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = s/n
 *         return self.tag_size
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":187
 *         # done
 *         self.fhd.seek( 0 )
 *         self.tag_size = s/n             # <<<<<<<<<<<<<<
 *         return self.tag_size
 * 
 */
  if (unlikely(__pyx_v_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_n == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_s))) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_OverflowError, "value too large to perform division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->tag_size = __Pyx_div_int(__pyx_v_s, __pyx_v_n);

  /* "MACS2/IO/cParser.pyx":188
 *         self.fhd.seek( 0 )
 *         self.tag_size = s/n
 *         return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *     def __tlen_parse_line ( self, str thisline ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tag_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.tsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_5__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_4__tlen_parse_line[] = "Abstract function to detect tag length.\n        \n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_5__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_4__tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":190
 *         return self.tag_size
 * 
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Abstract function to detect tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_4__tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);

  /* "MACS2/IO/cParser.pyx":194
 * 
 *         """
 *         raise NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def build_fwtrack ( self ):
 */
  __Pyx_Raise(__pyx_builtin_NotImplemented, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_7build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_6build_fwtrack[] = "Generic function to build FWTrackIII object. Create a new\n        FWTrackIII object. If you want to append new records to an\n        existing FWTrackIII object, try append_fwtrack function.\n\n        * BAMParser for binary BAM format should have a different one.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_7build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_6build_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":196
 *         raise NotImplemented
 * 
 *     def build_fwtrack ( self ):             # <<<<<<<<<<<<<<
 *         """Generic function to build FWTrackIII object. Create a new
 *         FWTrackIII object. If you want to append new records to an
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_6build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self) {
  long __pyx_v_i;
  long __pyx_v_m;
  long __pyx_v_fpos;
  long __pyx_v_strand;
  PyObject *__pyx_v_chromosome = 0;
  PyObject *__pyx_v_fwtrack = NULL;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_fwtrack", 0);

  /* "MACS2/IO/cParser.pyx":207
 *             str chromosome
 * 
 *         fwtrack = FWTrackIII()             # <<<<<<<<<<<<<<
 *         i = 0
 *         m = 0
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__FWTrackIII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fwtrack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":208
 * 
 *         fwtrack = FWTrackIII()
 *         i = 0             # <<<<<<<<<<<<<<
 *         m = 0
 *         for thisline in self.fhd:
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":209
 *         fwtrack = FWTrackIII()
 *         i = 0
 *         m = 0             # <<<<<<<<<<<<<<
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":210
 *         i = 0
 *         m = 0
 *         for thisline in self.fhd:             # <<<<<<<<<<<<<<
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 */
  if (PyList_CheckExact(__pyx_v_self->fhd) || PyTuple_CheckExact(__pyx_v_self->fhd)) {
    __pyx_t_2 = __pyx_v_self->fhd; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->fhd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":211
 *         m = 0
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if fpos < 0 or not chromosome:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____fw_parse_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyInt_AsLong(__pyx_t_7); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_chromosome));
    __pyx_v_chromosome = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_fpos = __pyx_t_10;
    __pyx_v_strand = __pyx_t_11;

    /* "MACS2/IO/cParser.pyx":212
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if fpos < 0 or not chromosome:
 *                 # normally __fw_parse_line will return -1 if the line
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":213
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 *             if fpos < 0 or not chromosome:             # <<<<<<<<<<<<<<
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 */
    __pyx_t_12 = ((__pyx_v_fpos < 0) != 0);
    if (!__pyx_t_12) {
      __pyx_t_13 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_chromosome)); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_14 = ((!__pyx_t_13) != 0);
      __pyx_t_13 = __pyx_t_14;
    } else {
      __pyx_t_13 = __pyx_t_12;
    }
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":216
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 *                 continue             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":217
 *                 # contains no successful alignment.
 *                 continue
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_13 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":218
 *                 continue
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":219
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":220
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0             # <<<<<<<<<<<<<<
 *             fwtrack.add_loc( chromosome, fpos, strand )
 * 
 */
      __pyx_v_i = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":221
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *         # close fwtrack and sort
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_v_chromosome));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_chromosome));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chromosome));
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":224
 * 
 *         # close fwtrack and sort
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         # close file stream.
 *         self.close()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "MACS2/IO/cParser.pyx":226
 *         fwtrack.finalize()
 *         # close file stream.
 *         self.close()             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":227
 *         # close file stream.
 *         self.close()
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     def append_fwtrack ( self, fwtrack ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.build_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XDECREF(__pyx_v_fwtrack);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_9append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_8append_fwtrack[] = "Add more records to an existing FWTrackIII object. \n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_9append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_8append_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self), ((PyObject *)__pyx_v_fwtrack));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":229
 *         return fwtrack
 * 
 *     def append_fwtrack ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         """Add more records to an existing FWTrackIII object.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_8append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_v_chromosome = NULL;
  PyObject *__pyx_v_fpos = NULL;
  PyObject *__pyx_v_strand = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_fwtrack", 0);

  /* "MACS2/IO/cParser.pyx":233
 * 
 *         """
 *         i = 0             # <<<<<<<<<<<<<<
 *         m = 0
 *         for thisline in self.fhd:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_i = __pyx_int_0;

  /* "MACS2/IO/cParser.pyx":234
 *         """
 *         i = 0
 *         m = 0             # <<<<<<<<<<<<<<
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_m = __pyx_int_0;

  /* "MACS2/IO/cParser.pyx":235
 *         i = 0
 *         m = 0
 *         for thisline in self.fhd:             # <<<<<<<<<<<<<<
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 */
  if (PyList_CheckExact(__pyx_v_self->fhd) || PyTuple_CheckExact(__pyx_v_self->fhd)) {
    __pyx_t_1 = __pyx_v_self->fhd; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->fhd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "MACS2/IO/cParser.pyx":236
 *         m = 0
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if fpos < 0 or not chromosome:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____fw_parse_line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_chromosome);
    __pyx_v_chromosome = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_fpos);
    __pyx_v_fpos = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_strand);
    __pyx_v_strand = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "MACS2/IO/cParser.pyx":237
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if fpos < 0 or not chromosome:
 *                 # normally __fw_parse_line will return -1 if the line
 */
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "MACS2/IO/cParser.pyx":238
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 *             if fpos < 0 or not chromosome:             # <<<<<<<<<<<<<<
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_fpos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_10) {
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_chromosome); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = (!__pyx_t_11);
      __pyx_t_11 = __pyx_t_12;
    } else {
      __pyx_t_11 = __pyx_t_10;
    }
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":241
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 *                 continue             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":242
 *                 # contains no successful alignment.
 *                 continue
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_int_1000000, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":243
 *                 continue
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 */
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_m, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_v_m);
      __pyx_v_m = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "MACS2/IO/cParser.pyx":244
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Multiply(__pyx_v_m, __pyx_int_1000000); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "MACS2/IO/cParser.pyx":245
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0             # <<<<<<<<<<<<<<
 *             fwtrack.add_loc( chromosome, fpos, strand )
 * 
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF(__pyx_v_i);
      __pyx_v_i = __pyx_int_0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":246
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *         # close fwtrack and sort
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_chromosome);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chromosome);
    __Pyx_GIVEREF(__pyx_v_chromosome);
    __Pyx_INCREF(__pyx_v_fpos);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_fpos);
    __Pyx_GIVEREF(__pyx_v_fpos);
    __Pyx_INCREF(__pyx_v_strand);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_strand);
    __Pyx_GIVEREF(__pyx_v_strand);
    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":249
 * 
 *         # close fwtrack and sort
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         self.close()
 *         return fwtrack
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "MACS2/IO/cParser.pyx":250
 *         # close fwtrack and sort
 *         fwtrack.finalize()
 *         self.close()             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":251
 *         fwtrack.finalize()
 *         self.close()
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.append_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XDECREF(__pyx_v_fpos);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_11__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_10__fw_parse_line[] = "Abstract function to parse chromosome, 5' end position and\n        strand.\n        \n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_11__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_10__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":255
 * 
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Abstract function to parse chromosome, 5' end position and
 *         strand.
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_10__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_chromosome = 0;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);

  /* "MACS2/IO/cParser.pyx":260
 * 
 *         """
 *         cdef str chromosome = ""             # <<<<<<<<<<<<<<
 *         cdef int fpos = -1
 *         cdef int strand = -1
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  __pyx_v_chromosome = __pyx_kp_s_11;

  /* "MACS2/IO/cParser.pyx":261
 *         """
 *         cdef str chromosome = ""
 *         cdef int fpos = -1             # <<<<<<<<<<<<<<
 *         cdef int strand = -1
 *         return ( chromosome, fpos, strand )
 */
  __pyx_v_fpos = -1;

  /* "MACS2/IO/cParser.pyx":262
 *         cdef str chromosome = ""
 *         cdef int fpos = -1
 *         cdef int strand = -1             # <<<<<<<<<<<<<<
 *         return ( chromosome, fpos, strand )
 * 
 */
  __pyx_v_strand = -1;

  /* "MACS2/IO/cParser.pyx":263
 *         cdef int fpos = -1
 *         cdef int strand = -1
 *         return ( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *     def sniff ( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __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 = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_chromosome));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chromosome));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chromosome));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_13sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_12sniff[] = "Detect whether this parser is the correct parser for input\n        file.\n\n        Rule: try to find the tag size using this parser, if error\n        occurs or tag size is too small or too big, check is failed.\n\n        * BAMParser has a different sniff function.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_13sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sniff (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_12sniff(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":265
 *         return ( chromosome, fpos, strand )
 * 
 *     def sniff ( self ):             # <<<<<<<<<<<<<<
 *         """Detect whether this parser is the correct parser for input
 *         file.
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_12sniff(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self) {
  int __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sniff", 0);

  /* "MACS2/IO/cParser.pyx":276
 *         cdef int t
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             t = self.tsize()
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":277
 * 
 *         try:
 *             t = self.tsize()             # <<<<<<<<<<<<<<
 *         except:
 *             self.fhd.seek( 0 )
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_t = __pyx_t_6;
    }
    /*else:*/ {

      /* "MACS2/IO/cParser.pyx":282
 *             return False
 *         else:
 *             if t <= 10 or t >= 10000:             # <<<<<<<<<<<<<<
 *                 self.fhd.seek( 0 )
 *                 return False
 */
      __pyx_t_7 = ((__pyx_v_t <= 10) != 0);
      if (!__pyx_t_7) {
        __pyx_t_8 = ((__pyx_v_t >= 10000) != 0);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_7;
      }
      if (__pyx_t_9) {

        /* "MACS2/IO/cParser.pyx":283
 *         else:
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "MACS2/IO/cParser.pyx":284
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 self.fhd.seek( 0 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L6_except_return;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":286
 *                 return False
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "MACS2/IO/cParser.pyx":287
 *             else:
 *                 self.fhd.seek( 0 )
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *     def close ( self ):
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L6_except_return;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "MACS2/IO/cParser.pyx":278
 *         try:
 *             t = self.tsize()
 *         except:             # <<<<<<<<<<<<<<
 *             self.fhd.seek( 0 )
 *             return False
 */
    /*except:*/ {
      __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_10);

      /* "MACS2/IO/cParser.pyx":279
 *             t = self.tsize()
 *         except:
 *             self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "MACS2/IO/cParser.pyx":280
 *         except:
 *             self.fhd.seek( 0 )
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             if t <= 10 or t >= 10000:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_12 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_r = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("MACS2.IO.cParser.GenericParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_13GenericParser_14close[] = "Run this when this Parser will be never used.\n\n        Close file I/O stream.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_13GenericParser_14close(((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":289
 *                 return True
 * 
 *     def close ( self ):             # <<<<<<<<<<<<<<
 *         """Run this when this Parser will be never used.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_13GenericParser_14close(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "MACS2/IO/cParser.pyx":294
 *         Close file I/O stream.
 *         """
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 * 
 * cdef class BEDParser( GenericParser ):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __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_2); __pyx_t_2 = 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_AddTraceback("MACS2.IO.cParser.GenericParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_9BEDParser___tlen_parse_line[] = "Parse 5' and 3' position, then calculate tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BEDParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":300
 * 
 *     """
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse 5' and 3' position, then calculate tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BEDParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char *__pyx_t_8;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":304
 * 
 *         """
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline \
 *            or thisline[ :5 ] == "track" \
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":306
 *         thisline = thisline.rstrip()
 *         if not thisline \
 *            or thisline[ :5 ] == "track" \             # <<<<<<<<<<<<<<
 *            or thisline[ :7 ] == "browser"\
 *            or thisline[ 0 ] == "#":
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_3);
  if (!__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":307
 *         if not thisline \
 *            or thisline[ :5 ] == "track" \
 *            or thisline[ :7 ] == "browser"\             # <<<<<<<<<<<<<<
 *            or thisline[ 0 ] == "#":
 *             return 0
 */
    if (unlikely(((PyObject *)__pyx_v_thisline) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_thisline), 0, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = (__Pyx_PyString_Equals(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_s__track), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (!__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":308
 *            or thisline[ :5 ] == "track" \
 *            or thisline[ :7 ] == "browser"\
 *            or thisline[ 0 ] == "#":             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_thisline) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_thisline), 0, 7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = (__Pyx_PyString_Equals(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_s__browser), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_thisline), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_15), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_7;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":309
 *            or thisline[ :7 ] == "browser"\
 *            or thisline[ 0 ] == "#":
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( '\t' )
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":311
 *             return 0
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         return atoi( thisfields[ 2 ] )-atoi( thisfields[ 1 ] )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_thisfields = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":312
 * 
 *         thisfields = thisline.split( '\t' )
 *         return atoi( thisfields[ 2 ] )-atoi( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line ( self, str thisline ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong((atoi(__pyx_t_8) - atoi(__pyx_t_9))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("MACS2.IO.cParser.BEDParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BEDParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":314
 *         return atoi( thisfields[ 2 ] )-atoi( thisfields[ 1 ] )
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         #cdef list thisfields
 *         cdef char * chromname
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BEDParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  char *__pyx_v_chromname;
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":318
 *         cdef char * chromname
 * 
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 * 
 *         if not thisline or thisline[ :5 ] == "track" \
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":320
 *         thisline = thisline.rstrip()
 * 
 *         if not thisline or thisline[ :5 ] == "track" \             # <<<<<<<<<<<<<<
 *             or thisline[ :7 ] == "browser" \
 *             or thisline[ 0 ] == "#":
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_3);
  if (!__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":321
 * 
 *         if not thisline or thisline[ :5 ] == "track" \
 *             or thisline[ :7 ] == "browser" \             # <<<<<<<<<<<<<<
 *             or thisline[ 0 ] == "#":
 *              return ( "", -1, -1 )
 */
    if (unlikely(((PyObject *)__pyx_v_thisline) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_thisline), 0, 5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = (__Pyx_PyString_Equals(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_s__track), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (!__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":322
 *         if not thisline or thisline[ :5 ] == "track" \
 *             or thisline[ :7 ] == "browser" \
 *             or thisline[ 0 ] == "#":             # <<<<<<<<<<<<<<
 *              return ( "", -1, -1 )
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_thisline) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_thisline), 0, 7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __pyx_t_5 = (__Pyx_PyString_Equals(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_n_s__browser), Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_thisline), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_15), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_7;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":323
 *             or thisline[ :7 ] == "browser" \
 *             or thisline[ 0 ] == "#":
 *              return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( '\t' )
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_18));
    __pyx_r = ((PyObject *)__pyx_k_tuple_18);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":325
 *              return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         chromname = thisfields[ 0 ]
 *         #try:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_thisfields = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":326
 * 
 *         thisfields = thisline.split( '\t' )
 *         chromname = thisfields[ 0 ]             # <<<<<<<<<<<<<<
 *         #try:
 *         ##    chromname = chromname[ :chromname.rindex( ".fa" ) ]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_chromname = __pyx_t_8;

  /* "MACS2/IO/cParser.pyx":332
 *         #    pass
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if not strcmp(thisfields[ 5 ],"+"):
 *                 return ( chromname,
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":333
 * 
 *         try:
 *             if not strcmp(thisfields[ 5 ],"+"):             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 1 ] ),
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 5, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = ((!(strcmp(__pyx_t_8, __pyx_k_20) != 0)) != 0);
      if (__pyx_t_3) {

        /* "MACS2/IO/cParser.pyx":334
 *         try:
 *             if not strcmp(thisfields[ 5 ],"+"):
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 1 ] ),
 *                          0 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_chromname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));

        /* "MACS2/IO/cParser.pyx":335
 *             if not strcmp(thisfields[ 5 ],"+"):
 *                 return ( chromname,
 *                          atoi( thisfields[ 1 ] ),             # <<<<<<<<<<<<<<
 *                          0 )
 *             elif not strcmp(thisfields[ 5 ], "-"):
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyInt_FromLong(atoi(__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_r = ((PyObject *)__pyx_t_12);
        __pyx_t_12 = 0;
        goto __pyx_L8_try_return;
        goto __pyx_L12;
      }

      /* "MACS2/IO/cParser.pyx":337
 *                          atoi( thisfields[ 1 ] ),
 *                          0 )
 *             elif not strcmp(thisfields[ 5 ], "-"):             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 2 ] ),
 */
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_thisfields, 5, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_12); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_3 = ((!(strcmp(__pyx_t_8, __pyx_k_21) != 0)) != 0);
      if (__pyx_t_3) {

        /* "MACS2/IO/cParser.pyx":338
 *                          0 )
 *             elif not strcmp(thisfields[ 5 ], "-"):
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 2 ] ),
 *                          1 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_12 = __Pyx_PyBytes_FromString(__pyx_v_chromname); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_12));

        /* "MACS2/IO/cParser.pyx":339
 *             elif not strcmp(thisfields[ 5 ], "-"):
 *                 return ( chromname,
 *                          atoi( thisfields[ 2 ] ),             # <<<<<<<<<<<<<<
 *                          1 )
 *             else:
 */
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyInt_FromLong(atoi(__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_12));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        __pyx_t_12 = 0;
        __pyx_t_1 = 0;
        __pyx_r = ((PyObject *)__pyx_t_2);
        __pyx_t_2 = 0;
        goto __pyx_L8_try_return;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":342
 *                          1 )
 *             else:
 *                 raise StrandFormatError( thisline, thisfields[ 5 ] )             # <<<<<<<<<<<<<<
 *         except IndexError:
 *             # default pos strand if no strand
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__StrandFormatError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 5, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_INCREF(((PyObject *)__pyx_v_thisline));
        PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_thisline));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_thisline));
        PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      }
      __pyx_L12:;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L11_try_end;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":343
 *             else:
 *                 raise StrandFormatError( thisline, thisfields[ 5 ] )
 *         except IndexError:             # <<<<<<<<<<<<<<
 *             # default pos strand if no strand
 *             # info can be found
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_IndexError);
    if (__pyx_t_13) {
      __Pyx_AddTraceback("MACS2.IO.cParser.BEDParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_12, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GOTREF(__pyx_t_2);

      /* "MACS2/IO/cParser.pyx":346
 *             # default pos strand if no strand
 *             # info can be found
 *             return ( chromname,             # <<<<<<<<<<<<<<
 *                      atoi( thisfields[ 1 ] ),
 *                      0 )
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_14 = __Pyx_PyBytes_FromString(__pyx_v_chromname); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));

      /* "MACS2/IO/cParser.pyx":347
 *             # info can be found
 *             return ( chromname,
 *                      atoi( thisfields[ 1 ] ),             # <<<<<<<<<<<<<<
 *                      0 )
 * 
 */
      __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_15); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyInt_FromLong(atoi(__pyx_t_8)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_t_14));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_14 = 0;
      __pyx_t_15 = 0;
      __pyx_r = ((PyObject *)__pyx_t_16);
      __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L7_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    __pyx_L11_try_end:;
  }

  __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_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("MACS2.IO.cParser.BEDParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_17ELANDResultParser___tlen_parse_line[] = "Parse tag sequence, then tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":355
 * 
 *     """
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse tag sequence, then tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":359
 * 
 *         """
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":360
 *         """
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":361
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if thisfields[1].isdigit():
 *             return 0
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_thisfields = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":362
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isdigit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":363
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():
 *             return 0             # <<<<<<<<<<<<<<
 *         else:
 *             return len( thisfields[ 1 ] )
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":365
 *             return 0
 *         else:
 *             return len( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line ( self, str thisline ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __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_AddTraceback("MACS2.IO.cParser.ELANDResultParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":367
 *             return len( thisfields[ 1 ] )
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             str chromname, strand
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDResultParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_chromname = 0;
  PyObject *__pyx_v_strand = 0;
  int __pyx_v_thistaglength;
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":372
 *             int thistaglength
 *         #if thisline.startswith("#") or thisline.startswith("track") or thisline.startswith("browser"): return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":373
 *         #if thisline.startswith("#") or thisline.startswith("track") or thisline.startswith("browser"): return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_23));
    __pyx_r = ((PyObject *)__pyx_k_tuple_23);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":375
 *         if not thisline: return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistaglength = strlen( thisfields[ 1 ] )
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_thisfields = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":376
 * 
 *         thisfields = thisline.split( '\t' )
 *         thistaglength = strlen( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 * 
 *         if len( thisfields ) <= 6:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_thistaglength = strlen(__pyx_t_5);

  /* "MACS2/IO/cParser.pyx":378
 *         thistaglength = strlen( thisfields[ 1 ] )
 * 
 *         if len( thisfields ) <= 6:             # <<<<<<<<<<<<<<
 *             return ( "", -1, -1 )
 * 
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_thisfields); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((__pyx_t_6 <= 6) != 0);
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":379
 * 
 *         if len( thisfields ) <= 6:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_25));
    __pyx_r = ((PyObject *)__pyx_k_tuple_25);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":381
 *             return ( "", -1, -1 )
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             chromname = thisfields[ 6 ]
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":382
 * 
 *         try:
 *             chromname = thisfields[ 6 ]             # <<<<<<<<<<<<<<
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *         except ValueError:
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 6, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __pyx_v_chromname = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":383
 *         try:
 *             chromname = thisfields[ 6 ]
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
      if (unlikely(((PyObject *)__pyx_v_chromname) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_chromname), __pyx_n_s__rindex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_chromname), 0, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_v_chromname));
      __pyx_v_chromname = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":384
 *             chromname = thisfields[ 6 ]
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_10) {
      PyErr_Restore(0,0,0);
      goto __pyx_L6_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L12_try_end:;
  }

  /* "MACS2/IO/cParser.pyx":387
 *             pass
 * 
 *         if thisfields[ 2 ] == "U0" or thisfields[ 2 ] == "U1" or thisfields[ 2 ] == "U2":             # <<<<<<<<<<<<<<
 *             # allow up to 2 mismatches...
 *             strand = thisfields[ 8 ]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__U0), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__U1), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_3) {
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__U2), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = __pyx_t_11;
    } else {
      __pyx_t_12 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_12;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":389
 *         if thisfields[ 2 ] == "U0" or thisfields[ 2 ] == "U1" or thisfields[ 2 ] == "U2":
 *             # allow up to 2 mismatches...
 *             strand = thisfields[ 8 ]             # <<<<<<<<<<<<<<
 *             if strand == "F":
 *                 return ( chromname,
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 8, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_strand = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":390
 *             # allow up to 2 mismatches...
 *             strand = thisfields[ 8 ]
 *             if strand == "F":             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 7 ] ) - 1,
 */
    __pyx_t_3 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__F), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":391
 *             strand = thisfields[ 8 ]
 *             if strand == "F":
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 7 ] ) - 1,
 *                          0 )
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_chromname)) { __Pyx_RaiseUnboundLocalError("chromname"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }

      /* "MACS2/IO/cParser.pyx":392
 *             if strand == "F":
 *                 return ( chromname,
 *                          atoi( thisfields[ 7 ] ) - 1,             # <<<<<<<<<<<<<<
 *                          0 )
 *             elif strand == "R":
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 7, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromLong((atoi(__pyx_t_5) - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __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 = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_chromname));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_chromname));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chromname));
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_1 = 0;
      __pyx_r = ((PyObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L14;
    }

    /* "MACS2/IO/cParser.pyx":394
 *                          atoi( thisfields[ 7 ] ) - 1,
 *                          0 )
 *             elif strand == "R":             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 7 ] ) + thistaglength - 1,
 */
    __pyx_t_4 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__R), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":395
 *                          0 )
 *             elif strand == "R":
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 7 ] ) + thistaglength - 1,
 *                          1 )
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_chromname)) { __Pyx_RaiseUnboundLocalError("chromname"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }

      /* "MACS2/IO/cParser.pyx":396
 *             elif strand == "R":
 *                 return ( chromname,
 *                          atoi( thisfields[ 7 ] ) + thistaglength - 1,             # <<<<<<<<<<<<<<
 *                          1 )
 *             else:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisfields, 7, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromLong(((atoi(__pyx_t_5) + __pyx_v_thistaglength) - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_chromname));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chromname));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chromname));
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      __pyx_t_2 = 0;
      __pyx_r = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":399
 *                          1 )
 *             else:
 *                 raise StrandFormatError( thisline, strand )             # <<<<<<<<<<<<<<
 *         else:
 *             return ( "", -1, -1 )
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__StrandFormatError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_thisline));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_thisline));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_thisline));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_13, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L14:;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":401
 *                 raise StrandFormatError( thisline, strand )
 *         else:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 * cdef class ELANDMultiParser( GenericParser ):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_28));
    __pyx_r = ((PyObject *)__pyx_k_tuple_28);
    goto __pyx_L0;
  }
  __pyx_L13:;

  __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_13);
  __Pyx_AddTraceback("MACS2.IO.cParser.ELANDResultParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chromname);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_16ELANDMultiParser___tlen_parse_line[] = "Parse tag sequence, then tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":420
 *     position 170128 with two errors. There is also a single-error match to E_coli.fa.
 *     """
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse tag sequence, then tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":424
 * 
 *         """
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":425
 *         """
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":426
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if thisfields[1].isdigit():
 *             return 0
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_thisfields = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":427
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():             # <<<<<<<<<<<<<<
 *             return 0
 *         else:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__isdigit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":428
 *         thisfields = thisline.split( '\t' )
 *         if thisfields[1].isdigit():
 *             return 0             # <<<<<<<<<<<<<<
 *         else:
 *             return len( thisfields[ 1 ] )
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":430
 *             return 0
 *         else:
 *             return len( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line ( self, str thisline ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __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_AddTraceback("MACS2.IO.cParser.ELANDMultiParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":432
 *             return len( thisfields[ 1 ] )
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list thisfields
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_16ELANDMultiParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  CYTHON_UNUSED PyObject *__pyx_v_thistagname = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_strand = 0;
  int __pyx_v_thistaglength;
  int __pyx_v_thistaghits;
  PyObject *__pyx_v_chromname = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":438
 *             int thistaglength, thistaghits
 * 
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_30));
    __pyx_r = ((PyObject *)__pyx_k_tuple_30);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":439
 * 
 *         if not thisline: return ( "", -1, -1 )
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":440
 *         if not thisline: return ( "", -1, -1 )
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         #if thisline[ 0 ] == "#": return ( "", -1, -1 ) # comment line is skipped
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_31));
    __pyx_r = ((PyObject *)__pyx_k_tuple_31);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":444
 *         #if thisline[ 0 ] == "#": return ( "", -1, -1 ) # comment line is skipped
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistagname = thisfields[ 0 ]        # name of tag
 *         thistaglength = len( thisfields[ 1 ] ) # length of tag
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":445
 * 
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]        # name of tag             # <<<<<<<<<<<<<<
 *         thistaglength = len( thisfields[ 1 ] ) # length of tag
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thistagname = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":446
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]        # name of tag
 *         thistaglength = len( thisfields[ 1 ] ) # length of tag             # <<<<<<<<<<<<<<
 * 
 *         if len( thisfields ) < 4:
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_thistaglength = __pyx_t_5;

  /* "MACS2/IO/cParser.pyx":448
 *         thistaglength = len( thisfields[ 1 ] ) # length of tag
 * 
 *         if len( thisfields ) < 4:             # <<<<<<<<<<<<<<
 *             return ( "", -1, -1 )
 *         else:
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_thisfields)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((__pyx_t_5 < 4) != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":449
 * 
 *         if len( thisfields ) < 4:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         else:
 *             thistaghits = sum( map( int, thisfields[ 2 ].split( ':' ) ) )
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_33));
    __pyx_r = ((PyObject *)__pyx_k_tuple_33);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":451
 *             return ( "", -1, -1 )
 *         else:
 *             thistaghits = sum( map( int, thisfields[ 2 ].split( ':' ) ) )             # <<<<<<<<<<<<<<
 *             if thistaghits > 1:
 *                 # multiple hits
 */
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 2, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)((PyObject*)(&PyInt_Type))));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)(&PyInt_Type))));
    __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyInt_Type))));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_map, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_sum, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_thistaghits = __pyx_t_6;

    /* "MACS2/IO/cParser.pyx":452
 *         else:
 *             thistaghits = sum( map( int, thisfields[ 2 ].split( ':' ) ) )
 *             if thistaghits > 1:             # <<<<<<<<<<<<<<
 *                 # multiple hits
 *                 return ( "", -1, -1 )
 */
    __pyx_t_1 = ((__pyx_v_thistaghits > 1) != 0);
    if (__pyx_t_1) {

      /* "MACS2/IO/cParser.pyx":454
 *             if thistaghits > 1:
 *                 # multiple hits
 *                 return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *             else:
 *                 ( chromname, pos ) = thisfields[ 3 ].split( ':' )
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_36));
      __pyx_r = ((PyObject *)__pyx_k_tuple_36);
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":456
 *                 return ( "", -1, -1 )
 *             else:
 *                 ( chromname, pos ) = thisfields[ 3 ].split( ':' )             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 3, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L8_unpacking_done;
        __pyx_L7_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L8_unpacking_done:;
      }
      if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_chromname = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_v_pos = ((PyObject*)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "MACS2/IO/cParser.pyx":458
 *                 ( chromname, pos ) = thisfields[ 3 ].split( ':' )
 * 
 *                 try:             # <<<<<<<<<<<<<<
 *                     chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *                 except ValueError:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "MACS2/IO/cParser.pyx":459
 * 
 *                 try:
 *                     chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *                 except ValueError:
 *                     pass
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_chromname, __pyx_n_s__rindex); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_chromname, 0, 0, NULL, &__pyx_t_7, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_v_chromname);
          __pyx_v_chromname = __pyx_t_3;
          __pyx_t_3 = 0;
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L16_try_end;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "MACS2/IO/cParser.pyx":460
 *                 try:
 *                     chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *                 except ValueError:             # <<<<<<<<<<<<<<
 *                     pass
 * 
 */
        __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
        if (__pyx_t_6) {
          PyErr_Restore(0,0,0);
          goto __pyx_L10_exception_handled;
        }
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L10_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        __pyx_L16_try_end:;
      }

      /* "MACS2/IO/cParser.pyx":463
 *                     pass
 * 
 *                 strand  = pos[ -2 ]             # <<<<<<<<<<<<<<
 *                 if strand == "F":
 *                     return ( chromname,
 */
      __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_pos), -2, sizeof(long), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_strand = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":464
 * 
 *                 strand  = pos[ -2 ]
 *                 if strand == "F":             # <<<<<<<<<<<<<<
 *                     return ( chromname,
 *                              int( pos[ :-2 ] )-1,
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__F), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "MACS2/IO/cParser.pyx":465
 *                 strand  = pos[ -2 ]
 *                 if strand == "F":
 *                     return ( chromname,             # <<<<<<<<<<<<<<
 *                              int( pos[ :-2 ] )-1,
 *                              0 )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "MACS2/IO/cParser.pyx":466
 *                 if strand == "F":
 *                     return ( chromname,
 *                              int( pos[ :-2 ] )-1,             # <<<<<<<<<<<<<<
 *                              0 )
 *                 elif strand == "R":
 */
        if (unlikely(((PyObject *)__pyx_v_pos) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_pos), 0, -2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_chromname);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chromname);
        __Pyx_GIVEREF(__pyx_v_chromname);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_7 = 0;
        __pyx_r = ((PyObject *)__pyx_t_3);
        __pyx_t_3 = 0;
        goto __pyx_L0;
        goto __pyx_L17;
      }

      /* "MACS2/IO/cParser.pyx":468
 *                              int( pos[ :-2 ] )-1,
 *                              0 )
 *                 elif strand == "R":             # <<<<<<<<<<<<<<
 *                     return ( chromname,
 *                              int( pos[ :-2 ] ) + thistaglength - 1,
 */
      __pyx_t_2 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__R), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "MACS2/IO/cParser.pyx":469
 *                              0 )
 *                 elif strand == "R":
 *                     return ( chromname,             # <<<<<<<<<<<<<<
 *                              int( pos[ :-2 ] ) + thistaglength - 1,
 *                              1 )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "MACS2/IO/cParser.pyx":470
 *                 elif strand == "R":
 *                     return ( chromname,
 *                              int( pos[ :-2 ] ) + thistaglength - 1,             # <<<<<<<<<<<<<<
 *                              1 )
 *                 else:
 */
        if (unlikely(((PyObject *)__pyx_v_pos) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_pos), 0, -2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __pyx_t_7 = PyInt_FromLong(__pyx_v_thistaglength); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Subtract(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_chromname);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chromname);
        __Pyx_GIVEREF(__pyx_v_chromname);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        __pyx_t_7 = 0;
        __pyx_r = ((PyObject *)__pyx_t_4);
        __pyx_t_4 = 0;
        goto __pyx_L0;
        goto __pyx_L17;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":473
 *                              1 )
 *                 else:
 *                     raise StrandFormatError( thisline,strand )             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__StrandFormatError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(((PyObject *)__pyx_v_thisline));
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_thisline));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_thisline));
        __Pyx_INCREF(((PyObject *)__pyx_v_strand));
        PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_strand));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
        __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L17:;
    }
    __pyx_L6:;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.ELANDMultiParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thistagname);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_chromname);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_17ELANDExportParser___tlen_parse_line[] = "Parse tag sequence, then tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":480
 * 
 *     """
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse tag sequence, then tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":484
 * 
 *         """
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":485
 *         """
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         if len( thisfields ) > 12 and thisfields[ 12 ]:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":486
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if len( thisfields ) > 12 and thisfields[ 12 ]:
 *             # a successful alignment has over 12 columns
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_thisfields = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":487
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )
 *         if len( thisfields ) > 12 and thisfields[ 12 ]:             # <<<<<<<<<<<<<<
 *             # a successful alignment has over 12 columns
 *             return len( thisfields[ 8 ] )
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_thisfields); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_5 > 12);
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 12, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (__pyx_t_6) {

    /* "MACS2/IO/cParser.pyx":489
 *         if len( thisfields ) > 12 and thisfields[ 12 ]:
 *             # a successful alignment has over 12 columns
 *             return len( thisfields[ 8 ] )             # <<<<<<<<<<<<<<
 *         else:
 *             return 0
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_thisfields, 8, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":491
 *             return len( thisfields[ 8 ] )
 *         else:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line ( self, str thisline ):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __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_AddTraceback("MACS2.IO.cParser.ELANDExportParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":493
 *             return 0
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list thisfields
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_17ELANDExportParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  CYTHON_UNUSED PyObject *__pyx_v_thisname = 0;
  PyObject *__pyx_v_strand = 0;
  int __pyx_v_thistaglength;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  char *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":500
 * 
 *         #if thisline.startswith("#") : return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":501
 *         #if thisline.startswith("#") : return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( "\t" )
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_40));
    __pyx_r = ((PyObject *)__pyx_k_tuple_40);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":503
 *         if not thisline: return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( "\t" )             # <<<<<<<<<<<<<<
 * 
 *         if len(thisfields) > 12 and thisfields[ 12 ]:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":505
 *         thisfields = thisline.split( "\t" )
 * 
 *         if len(thisfields) > 12 and thisfields[ 12 ]:             # <<<<<<<<<<<<<<
 *             thisname = ":".join( thisfields[ 0:6 ] )
 *             thistaglength = len( thisfields[ 8 ] )
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_thisfields)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_5 > 12);
  if (__pyx_t_4) {
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 12, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_3;
  } else {
    __pyx_t_6 = __pyx_t_4;
  }
  if (__pyx_t_6) {

    /* "MACS2/IO/cParser.pyx":506
 * 
 *         if len(thisfields) > 12 and thisfields[ 12 ]:
 *             thisname = ":".join( thisfields[ 0:6 ] )             # <<<<<<<<<<<<<<
 *             thistaglength = len( thisfields[ 8 ] )
 *             strand = thisfields[ 13 ]
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_34), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_PyList_GetSlice(((PyObject *)__pyx_v_thisfields), 0, 6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_thisname = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":507
 *         if len(thisfields) > 12 and thisfields[ 12 ]:
 *             thisname = ":".join( thisfields[ 0:6 ] )
 *             thistaglength = len( thisfields[ 8 ] )             # <<<<<<<<<<<<<<
 *             strand = thisfields[ 13 ]
 *             if strand == "F":
 */
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 8, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_thistaglength = __pyx_t_5;

    /* "MACS2/IO/cParser.pyx":508
 *             thisname = ":".join( thisfields[ 0:6 ] )
 *             thistaglength = len( thisfields[ 8 ] )
 *             strand = thisfields[ 13 ]             # <<<<<<<<<<<<<<
 *             if strand == "F":
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) - 1, 0 )
 */
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 13, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    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 = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_strand = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":509
 *             thistaglength = len( thisfields[ 8 ] )
 *             strand = thisfields[ 13 ]
 *             if strand == "F":             # <<<<<<<<<<<<<<
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) - 1, 0 )
 *             elif strand == "R":
 */
    __pyx_t_6 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__F), Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (__pyx_t_6 != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":510
 *             strand = thisfields[ 13 ]
 *             if strand == "F":
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) - 1, 0 )             # <<<<<<<<<<<<<<
 *             elif strand == "R":
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) + thistaglength - 1, 1 )
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 10, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 12, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyInt_FromLong((atoi(__pyx_t_8) - 1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_r = ((PyObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }

    /* "MACS2/IO/cParser.pyx":511
 *             if strand == "F":
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) - 1, 0 )
 *             elif strand == "R":             # <<<<<<<<<<<<<<
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) + thistaglength - 1, 1 )
 *             else:
 */
    __pyx_t_4 = (__Pyx_PyString_Equals(((PyObject *)__pyx_v_strand), ((PyObject *)__pyx_n_s__R), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (__pyx_t_4 != 0);
    if (__pyx_t_6) {

      /* "MACS2/IO/cParser.pyx":512
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) - 1, 0 )
 *             elif strand == "R":
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) + thistaglength - 1, 1 )             # <<<<<<<<<<<<<<
 *             else:
 *                 raise StrandFormatError( thisline, strand )
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 10, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 12, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyInt_FromLong(((atoi(__pyx_t_8) + __pyx_v_thistaglength) - 1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      __pyx_t_1 = 0;
      __pyx_t_7 = 0;
      __pyx_r = ((PyObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":514
 *                 return ( thisfields[ 10 ], atoi( thisfields[ 12 ] ) + thistaglength - 1, 1 )
 *             else:
 *                 raise StrandFormatError( thisline, strand )             # <<<<<<<<<<<<<<
 *         else:
 *             return ( -1, -1, -1 )
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__StrandFormatError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_v_thisline));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_thisline));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_thisline));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":516
 *                 raise StrandFormatError( thisline, strand )
 *         else:
 *             return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 * 
 * ### Contributed by Davide, modified by Tao
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_42));
    __pyx_r = ((PyObject *)__pyx_k_tuple_42);
    goto __pyx_L0;
  }
  __pyx_L4:;

  __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_7);
  __Pyx_AddTraceback("MACS2.IO.cParser.ELANDExportParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisname);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_9SAMParser___tlen_parse_line[] = "Parse tag sequence, then tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9SAMParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":551
 *     """
 * 
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse tag sequence, then tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9SAMParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  int __pyx_v_bwflag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":559
 *             int bwflag
 * 
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return 0
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":560
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":561
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         bwflag = atoi( thisfields[ 1 ] )
 */
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_thisline), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_43), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":562
 *         if not thisline: return 0
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_44), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":563
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )
 *         bwflag = atoi( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return 0       #unmapped sequence or bad sequence
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bwflag = atoi(__pyx_t_5);

  /* "MACS2/IO/cParser.pyx":564
 *         thisfields = thisline.split( '\t' )
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:             # <<<<<<<<<<<<<<
 *             return 0       #unmapped sequence or bad sequence
 *         if bwflag & 1:
 */
  __pyx_t_4 = ((__pyx_v_bwflag & 4) != 0);
  if (!__pyx_t_4) {
    __pyx_t_3 = ((__pyx_v_bwflag & 512) != 0);
    if (!__pyx_t_3) {
      __pyx_t_6 = ((__pyx_v_bwflag & 1024) != 0);
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_7;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":565
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return 0       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "MACS2/IO/cParser.pyx":566
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return 0       #unmapped sequence or bad sequence
 *         if bwflag & 1:             # <<<<<<<<<<<<<<
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 */
  __pyx_t_3 = ((__pyx_v_bwflag & 1) != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":569
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:             # <<<<<<<<<<<<<<
 *                 return 0   # not a proper pair
 *             if bwflag & 8:
 */
    __pyx_t_3 = ((!((__pyx_v_bwflag & 2) != 0)) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":570
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return 0   # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return 0   # the mate is unmapped
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":571
 *             if not bwflag & 2:
 *                 return 0   # not a proper pair
 *             if bwflag & 8:             # <<<<<<<<<<<<<<
 *                 return 0   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 */
    __pyx_t_3 = ((__pyx_v_bwflag & 8) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":572
 *                 return 0   # not a proper pair
 *             if bwflag & 8:
 *                 return 0   # the mate is unmapped             # <<<<<<<<<<<<<<
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":574
 *                 return 0   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:             # <<<<<<<<<<<<<<
 *                 # this is not the first read in a pair
 *                 return 0
 */
    __pyx_t_3 = ((__pyx_v_bwflag & 128) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":576
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return 0             # <<<<<<<<<<<<<<
 *         return len( thisfields[ 9 ] )
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "MACS2/IO/cParser.pyx":577
 *                 # this is not the first read in a pair
 *                 return 0
 *         return len( thisfields[ 9 ] )             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line ( self, thisline ):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 9, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("MACS2.IO.cParser.SAMParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9SAMParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *)__pyx_v_self), ((PyObject *)__pyx_v_thisline));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":579
 *         return len( thisfields[ 9 ] )
 * 
 *     def __fw_parse_line ( self, thisline ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             list thisfields
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9SAMParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  CYTHON_UNUSED PyObject *__pyx_v_thistagname = 0;
  PyObject *__pyx_v_thisref = 0;
  int __pyx_v_bwflag;
  int __pyx_v_thisstrand;
  int __pyx_v_thisstart;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":585
 *             int bwflag, thisstrand, thisstart
 * 
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_thisline, __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_thisline);
  __pyx_v_thisline = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":586
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_thisline); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_45));
    __pyx_r = ((PyObject *)__pyx_k_tuple_45);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":587
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]         # name of tag
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_thisline, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_43), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_46));
    __pyx_r = ((PyObject *)__pyx_k_tuple_46);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":588
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistagname = thisfields[ 0 ]         # name of tag
 *         thisref = thisfields[ 2 ]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_thisline, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":589
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]         # name of tag             # <<<<<<<<<<<<<<
 *         thisref = thisfields[ 2 ]
 *         bwflag = atoi( thisfields[ 1 ] )
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  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 = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thistagname = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":590
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]         # name of tag
 *         thisref = thisfields[ 2 ]             # <<<<<<<<<<<<<<
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 2, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  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 = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisref = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":591
 *         thistagname = thisfields[ 0 ]         # name of tag
 *         thisref = thisfields[ 2 ]
 *         bwflag = atoi( thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( "", -1, -1 )       #unmapped sequence or bad sequence
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bwflag = atoi(__pyx_t_5);

  /* "MACS2/IO/cParser.pyx":592
 *         thisref = thisfields[ 2 ]
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:             # <<<<<<<<<<<<<<
 *             return ( "", -1, -1 )       #unmapped sequence or bad sequence
 *         if bwflag & 1:
 */
  __pyx_t_4 = ((__pyx_v_bwflag & 4) != 0);
  if (!__pyx_t_4) {
    __pyx_t_3 = ((__pyx_v_bwflag & 512) != 0);
    if (!__pyx_t_3) {
      __pyx_t_6 = ((__pyx_v_bwflag & 1024) != 0);
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_7;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":593
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( "", -1, -1 )       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_48));
    __pyx_r = ((PyObject *)__pyx_k_tuple_48);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "MACS2/IO/cParser.pyx":594
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( "", -1, -1 )       #unmapped sequence or bad sequence
 *         if bwflag & 1:             # <<<<<<<<<<<<<<
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 */
  __pyx_t_3 = ((__pyx_v_bwflag & 1) != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":597
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:             # <<<<<<<<<<<<<<
 *                 return ( "", -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 */
    __pyx_t_3 = ((!((__pyx_v_bwflag & 2) != 0)) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":598
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return ( "", -1, -1 )   # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return ( "", -1, -1 )   # the mate is unmapped
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_49));
      __pyx_r = ((PyObject *)__pyx_k_tuple_49);
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":599
 *             if not bwflag & 2:
 *                 return ( "", -1, -1 )   # not a proper pair
 *             if bwflag & 8:             # <<<<<<<<<<<<<<
 *                 return ( "", -1, -1 )   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 */
    __pyx_t_3 = ((__pyx_v_bwflag & 8) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":600
 *                 return ( "", -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 *                 return ( "", -1, -1 )   # the mate is unmapped             # <<<<<<<<<<<<<<
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_50));
      __pyx_r = ((PyObject *)__pyx_k_tuple_50);
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":602
 *                 return ( "", -1, -1 )   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:             # <<<<<<<<<<<<<<
 *                 # this is not the first read in a pair
 *                 return ( "", -1, -1 )
 */
    __pyx_t_3 = ((__pyx_v_bwflag & 128) != 0);
    if (__pyx_t_3) {

      /* "MACS2/IO/cParser.pyx":604
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *             # end of the patch
 *         # In case of paired-end we have now skipped all possible "bad" pairs
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_51));
      __pyx_r = ((PyObject *)__pyx_k_tuple_51);
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "MACS2/IO/cParser.pyx":610
 *         # we can treat it as a single read, so just check the strand and calculate its
 *         # start position... hope I'm right!
 *         if bwflag & 16:             # <<<<<<<<<<<<<<
 *             thisstrand = 1
 *             thisstart = atoi( thisfields[ 3 ] ) - 1 + strlen( thisfields[ 9 ] )	#reverse strand should be shifted len(query) bp
 */
  __pyx_t_3 = ((__pyx_v_bwflag & 16) != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":611
 *         # start position... hope I'm right!
 *         if bwflag & 16:
 *             thisstrand = 1             # <<<<<<<<<<<<<<
 *             thisstart = atoi( thisfields[ 3 ] ) - 1 + strlen( thisfields[ 9 ] )	#reverse strand should be shifted len(query) bp
 *         else:
 */
    __pyx_v_thisstrand = 1;

    /* "MACS2/IO/cParser.pyx":612
 *         if bwflag & 16:
 *             thisstrand = 1
 *             thisstart = atoi( thisfields[ 3 ] ) - 1 + strlen( thisfields[ 9 ] )	#reverse strand should be shifted len(query) bp             # <<<<<<<<<<<<<<
 *         else:
 *             thisstrand = 0
 */
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 3, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 9, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_thisstart = ((atoi(__pyx_t_5) - 1) + strlen(__pyx_t_8));
    goto __pyx_L10;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":614
 *             thisstart = atoi( thisfields[ 3 ] ) - 1 + strlen( thisfields[ 9 ] )	#reverse strand should be shifted len(query) bp
 *         else:
 *             thisstrand = 0             # <<<<<<<<<<<<<<
 *             thisstart = atoi( thisfields[ 3 ] ) - 1
 * 
 */
    __pyx_v_thisstrand = 0;

    /* "MACS2/IO/cParser.pyx":615
 *         else:
 *             thisstrand = 0
 *             thisstart = atoi( thisfields[ 3 ] ) - 1             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 3, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_thisstart = (atoi(__pyx_t_8) - 1);
  }
  __pyx_L10:;

  /* "MACS2/IO/cParser.pyx":617
 *             thisstart = atoi( thisfields[ 3 ] ) - 1
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             thisref = thisref[ :thisref.rindex( ".fa" ) ]
 *         except ValueError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":618
 * 
 *         try:
 *             thisref = thisref[ :thisref.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
      if (unlikely(((PyObject *)__pyx_v_thisref) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisref), __pyx_n_s__rindex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_thisref), 0, __pyx_t_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_v_thisref));
      __pyx_v_thisref = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L18_try_end;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":619
 *         try:
 *             thisref = thisref[ :thisref.rindex( ".fa" ) ]
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             pass
 *         return ( thisref, thisstart, thisstrand )
 */
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_13) {
      PyErr_Restore(0,0,0);
      goto __pyx_L12_exception_handled;
    }
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L12_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    __pyx_L18_try_end:;
  }

  /* "MACS2/IO/cParser.pyx":621
 *         except ValueError:
 *             pass
 *         return ( thisref, thisstart, thisstrand )             # <<<<<<<<<<<<<<
 * 
 * cdef class BAMParser( GenericParser ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_thisstart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_thisstrand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_INCREF(((PyObject *)__pyx_v_thisref));
  PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_thisref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_thisref));
  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_14);
  __pyx_t_14 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("MACS2.IO.cParser.SAMParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thistagname);
  __Pyx_XDECREF(__pyx_v_thisref);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5MACS2_2IO_7cParser_9BAMParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_9BAMParser___init__[] = "Open input file. Determine whether it's a gzipped file.\n\n        'filename' must be a string object.\n\n        This function initialize the following attributes:\n\n        1. self.filename: the filename for input file.\n        2. self.gzipped: a boolean indicating whether input file is gzipped.\n        3. self.fhd: buffered I/O stream of input file\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_5MACS2_2IO_7cParser_9BAMParser___init__;
#endif
static int __pyx_pw_5MACS2_2IO_7cParser_9BAMParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser___init__(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self), __pyx_v_filename);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":644
 *     1024	PCR or optical duplicate
 *     """
 *     def __init__ ( self, str filename ):             # <<<<<<<<<<<<<<
 *         """Open input file. Determine whether it's a gzipped file.
 * 
 */

static int __pyx_pf_5MACS2_2IO_7cParser_9BAMParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_f = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "MACS2/IO/cParser.pyx":655
 *         3. self.fhd: buffered I/O stream of input file
 *         """
 *         self.filename = filename             # <<<<<<<<<<<<<<
 *         self.gzipped = True
 *         self.tag_size = -1
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_filename));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.filename);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.filename));
  __pyx_v_self->__pyx_base.filename = __pyx_v_filename;

  /* "MACS2/IO/cParser.pyx":656
 *         """
 *         self.filename = filename
 *         self.gzipped = True             # <<<<<<<<<<<<<<
 *         self.tag_size = -1
 *         if HAS_PYSAM:
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.gzipped);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.gzipped));
  __pyx_v_self->__pyx_base.gzipped = ((PyBoolObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":657
 *         self.filename = filename
 *         self.gzipped = True
 *         self.tag_size = -1             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             self.fhd = pysam.Samfile(filename)
 */
  __pyx_v_self->__pyx_base.tag_size = -1;

  /* "MACS2/IO/cParser.pyx":658
 *         self.gzipped = True
 *         self.tag_size = -1
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             self.fhd = pysam.Samfile(filename)
 *         else:
 */
  __pyx_t_2 = (HAS_PYSAM != 0);
  if (__pyx_t_2) {

    /* "MACS2/IO/cParser.pyx":659
 *         self.tag_size = -1
 *         if HAS_PYSAM:
 *             self.fhd = pysam.Samfile(filename)             # <<<<<<<<<<<<<<
 *         else:
 *             # try gzip first
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pysam); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__Samfile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __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_1)); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.fhd);
    __Pyx_DECREF(__pyx_v_self->__pyx_base.fhd);
    __pyx_v_self->__pyx_base.fhd = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":662
 *         else:
 *             # try gzip first
 *             f = gzip.open( filename )             # <<<<<<<<<<<<<<
 *             try:
 *                 f.read( 10 )
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __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 = 662; __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_v_f = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":663
 *             # try gzip first
 *             f = gzip.open( filename )
 *             try:             # <<<<<<<<<<<<<<
 *                 f.read( 10 )
 *             except IOError:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":664
 *             f = gzip.open( filename )
 *             try:
 *                 f.read( 10 )             # <<<<<<<<<<<<<<
 *             except IOError:
 *                 # not a gzipped file
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L11_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "MACS2/IO/cParser.pyx":665
 *             try:
 *                 f.read( 10 )
 *             except IOError:             # <<<<<<<<<<<<<<
 *                 # not a gzipped file
 *                 self.gzipped = False
 */
      __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_IOError);
      if (__pyx_t_8) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);

        /* "MACS2/IO/cParser.pyx":667
 *             except IOError:
 *                 # not a gzipped file
 *                 self.gzipped = False             # <<<<<<<<<<<<<<
 *             f.close()
 *             if self.gzipped:
 */
        __pyx_t_9 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        if (!(likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GIVEREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_v_self->__pyx_base.gzipped);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.gzipped));
        __pyx_v_self->__pyx_base.gzipped = ((PyBoolObject *)__pyx_t_9);
        __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L5_exception_handled;
      }
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L1_error;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      __pyx_L11_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":668
 *                 # not a gzipped file
 *                 self.gzipped = False
 *             f.close()             # <<<<<<<<<<<<<<
 *             if self.gzipped:
 *                 # open with gzip.open, then wrap it with BufferedReader!
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":669
 *                 self.gzipped = False
 *             f.close()
 *             if self.gzipped:             # <<<<<<<<<<<<<<
 *                 # open with gzip.open, then wrap it with BufferedReader!
 *                 self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->__pyx_base.gzipped)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "MACS2/IO/cParser.pyx":671
 *             if self.gzipped:
 *                 # open with gzip.open, then wrap it with BufferedReader!
 *                 self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )             # <<<<<<<<<<<<<<
 *             else:
 *                 self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__BufferedReader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_filename));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_filename));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
      __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_9));
      if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_v_self->__pyx_base.fhd);
      __Pyx_DECREF(__pyx_v_self->__pyx_base.fhd);
      __pyx_v_self->__pyx_base.fhd = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":673
 *                 self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 *             else:
 *                 self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!             # <<<<<<<<<<<<<<
 * 
 *     def sniff( self ):
 */
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__open); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(((PyObject *)__pyx_v_filename));
      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_filename));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->__pyx_base.fhd);
      __Pyx_DECREF(__pyx_v_self->__pyx_base.fhd);
      __pyx_v_self->__pyx_base.fhd = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L14:;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_3sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_9BAMParser_2sniff[] = "Check the first 3 bytes of BAM file. If it's 'BAM', check\n        is success.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_3sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sniff (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_2sniff(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":675
 *                 self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 * 
 *     def sniff( self ):             # <<<<<<<<<<<<<<
 *         """Check the first 3 bytes of BAM file. If it's 'BAM', check
 *         is success.
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_2sniff(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  PyObject *__pyx_v_magic_header = NULL;
  PyObject *__pyx_v_tsize = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sniff", 0);

  /* "MACS2/IO/cParser.pyx":680
 * 
 *         """
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             try:
 *                 self.fhd.tell()
 */
  __pyx_t_1 = (HAS_PYSAM != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":681
 *         """
 *         if HAS_PYSAM:
 *             try:             # <<<<<<<<<<<<<<
 *                 self.fhd.tell()
 *             except:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":682
 *         if HAS_PYSAM:
 *             try:
 *                 self.fhd.tell()             # <<<<<<<<<<<<<<
 *             except:
 *                 return False
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      /*else:*/ {

        /* "MACS2/IO/cParser.pyx":686
 *                 return False
 *             else:
 *                 return True             # <<<<<<<<<<<<<<
 *         else:
 *             magic_header = self.fhd.read( 3 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L7_except_return;
      }
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "MACS2/IO/cParser.pyx":683
 *             try:
 *                 self.fhd.tell()
 *             except:             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
      /*except:*/ {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_t_7);

        /* "MACS2/IO/cParser.pyx":684
 *                 self.fhd.tell()
 *             except:
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 return True
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L7_except_return;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L5_exception_handled;
      }
      __pyx_L6_except_error:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      goto __pyx_L0;
      __pyx_L5_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_2);
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_L11_try_end:;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":688
 *                 return True
 *         else:
 *             magic_header = self.fhd.read( 3 )             # <<<<<<<<<<<<<<
 *             if magic_header == "BAM":
 *                 tsize  = self.tsize()
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_magic_header = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "MACS2/IO/cParser.pyx":689
 *         else:
 *             magic_header = self.fhd.read( 3 )
 *             if magic_header == "BAM":             # <<<<<<<<<<<<<<
 *                 tsize  = self.tsize()
 *                 if tsize > 0:
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_magic_header, ((PyObject *)__pyx_n_s__BAM), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_1) {

      /* "MACS2/IO/cParser.pyx":690
 *             magic_header = self.fhd.read( 3 )
 *             if magic_header == "BAM":
 *                 tsize  = self.tsize()             # <<<<<<<<<<<<<<
 *                 if tsize > 0:
 *                     self.fhd.seek( 0 )
 */
      __pyx_t_5 = PyInt_FromLong(((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->tsize(__pyx_v_self, 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_tsize = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "MACS2/IO/cParser.pyx":691
 *             if magic_header == "BAM":
 *                 tsize  = self.tsize()
 *                 if tsize > 0:             # <<<<<<<<<<<<<<
 *                     self.fhd.seek( 0 )
 *                     return True
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_tsize, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "MACS2/IO/cParser.pyx":692
 *                 tsize  = self.tsize()
 *                 if tsize > 0:
 *                     self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                     return True
 *                 else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "MACS2/IO/cParser.pyx":693
 *                 if tsize > 0:
 *                     self.fhd.seek( 0 )
 *                     return True             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.fhd.seek( 0 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":695
 *                     return True
 *                 else:
 *                     self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                     raise Exception( "File is not of a valid BAM format! %d" % tsize )
 *             else:
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "MACS2/IO/cParser.pyx":696
 *                 else:
 *                     self.fhd.seek( 0 )
 *                     raise Exception( "File is not of a valid BAM format! %d" % tsize )             # <<<<<<<<<<<<<<
 *             else:
 *                 self.fhd.seek( 0 )
 */
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_57), __pyx_v_tsize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":698
 *                     raise Exception( "File is not of a valid BAM format! %d" % tsize )
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "MACS2/IO/cParser.pyx":699
 *             else:
 *                 self.fhd.seek( 0 )
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *     cpdef int tsize ( self ):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L0;
    }
    __pyx_L14:;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_magic_header);
  __Pyx_XDECREF(__pyx_v_tsize);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":701
 *                 return False
 * 
 *     cpdef int tsize ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__tsize_w_pysam()
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_5tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static int __pyx_f_5MACS2_2IO_7cParser_9BAMParser_tsize(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tsize", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_5tsize)) {
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":702
 * 
 *     cpdef int tsize ( self ):
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             return self.__tsize_w_pysam()
 *         else:
 */
  __pyx_t_4 = (HAS_PYSAM != 0);
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":703
 *     cpdef int tsize ( self ):
 *         if HAS_PYSAM:
 *             return self.__tsize_w_pysam()             # <<<<<<<<<<<<<<
 *         else:
 *             return self.__tsize_wo_pysam()
 */
    __pyx_r = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___tsize_w_pysam(__pyx_v_self);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":705
 *             return self.__tsize_w_pysam()
 *         else:
 *             return self.__tsize_wo_pysam()             # <<<<<<<<<<<<<<
 * 
 *     cdef int __tsize_w_pysam( self ):
 */
    __pyx_r = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___tsize_wo_pysam(__pyx_v_self);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("MACS2.IO.cParser.BAMParser.tsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_5tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_5tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_4tsize(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":701
 *                 return False
 * 
 *     cpdef int tsize ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__tsize_w_pysam()
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_4tsize(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tsize", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->tsize(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.tsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":707
 *             return self.__tsize_wo_pysam()
 * 
 *     cdef int __tsize_w_pysam( self ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int n = 0                   # successful read of tag size
 */

static int __pyx_f_5MACS2_2IO_7cParser_9BAMParser___tsize_w_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  int __pyx_v_n;
  double __pyx_v_s;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tsize_w_pysam", 0);

  /* "MACS2/IO/cParser.pyx":709
 *     cdef int __tsize_w_pysam( self ):
 *         cdef:
 *             int n = 0                   # successful read of tag size             # <<<<<<<<<<<<<<
 *             double s = 0                # sum of tag sizes
 * 
 */
  __pyx_v_n = 0;

  /* "MACS2/IO/cParser.pyx":710
 *         cdef:
 *             int n = 0                   # successful read of tag size
 *             double s = 0                # sum of tag sizes             # <<<<<<<<<<<<<<
 * 
 *         if self.tag_size != -1:
 */
  __pyx_v_s = 0.0;

  /* "MACS2/IO/cParser.pyx":712
 *             double s = 0                # sum of tag sizes
 * 
 *         if self.tag_size != -1:             # <<<<<<<<<<<<<<
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size
 */
  __pyx_t_1 = ((__pyx_v_self->__pyx_base.tag_size != -1) != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":714
 *         if self.tag_size != -1:
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *         for n in range( 1, 11, 1 ):
 */
    __pyx_r = __pyx_v_self->__pyx_base.tag_size;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":716
 *             return self.tag_size
 * 
 *         for n in range( 1, 11, 1 ):             # <<<<<<<<<<<<<<
 *             try:
 *                 s += self.fhd.next().qlen
 */
  for (__pyx_t_2 = 1; __pyx_t_2 < 11; __pyx_t_2+=1) {
    __pyx_v_n = __pyx_t_2;

    /* "MACS2/IO/cParser.pyx":717
 * 
 *         for n in range( 1, 11, 1 ):
 *             try:             # <<<<<<<<<<<<<<
 *                 s += self.fhd.next().qlen
 *             except:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":718
 *         for n in range( 1, 11, 1 ):
 *             try:
 *                 s += self.fhd.next().qlen             # <<<<<<<<<<<<<<
 *             except:
 *                 break
 */
        __pyx_t_6 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__next); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__qlen); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_s = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "MACS2/IO/cParser.pyx":719
 *             try:
 *                 s += self.fhd.next().qlen
 *             except:             # <<<<<<<<<<<<<<
 *                 break
 *         self.tag_size = int( s/n )
 */
      /*except:*/ {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__tsize_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_6);

        /* "MACS2/IO/cParser.pyx":720
 *                 s += self.fhd.next().qlen
 *             except:
 *                 break             # <<<<<<<<<<<<<<
 *         self.tag_size = int( s/n )
 *         self.fhd.reset()
 */
        goto __pyx_L14_except_break;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L7_exception_handled;
        __pyx_L14_except_break:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L11_try_break;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L11_try_break:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L5_break;
      __pyx_L7_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      __pyx_L13_try_end:;
    }
  }
  __pyx_L5_break:;

  /* "MACS2/IO/cParser.pyx":721
 *             except:
 *                 break
 *         self.tag_size = int( s/n )             # <<<<<<<<<<<<<<
 *         self.fhd.reset()
 *         return self.tag_size
 */
  if (unlikely(__pyx_v_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->__pyx_base.tag_size = ((int)(__pyx_v_s / __pyx_v_n));

  /* "MACS2/IO/cParser.pyx":722
 *                 break
 *         self.tag_size = int( s/n )
 *         self.fhd.reset()             # <<<<<<<<<<<<<<
 *         return self.tag_size
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__reset); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "MACS2/IO/cParser.pyx":723
 *         self.tag_size = int( s/n )
 *         self.fhd.reset()
 *         return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *     cdef int __tsize_wo_pysam( self ):
 */
  __pyx_r = __pyx_v_self->__pyx_base.tag_size;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("MACS2.IO.cParser.BAMParser.__tsize_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":725
 *         return self.tag_size
 * 
 *     cdef int __tsize_wo_pysam( self ):             # <<<<<<<<<<<<<<
 *         """Get tag size from BAM file -- read l_seq field.
 * 
 */

static int __pyx_f_5MACS2_2IO_7cParser_9BAMParser___tsize_wo_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_x;
  int __pyx_v_header_len;
  int __pyx_v_nc;
  int __pyx_v_nlength;
  int __pyx_v_n;
  double __pyx_v_s;
  PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_v_entrylength = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_a = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tsize_wo_pysam", 0);

  /* "MACS2/IO/cParser.pyx":736
 *         cdef:
 *             int x, header_len, nc, nlength
 *             int n = 0                   # successful read of tag size             # <<<<<<<<<<<<<<
 *             double s = 0                # sum of tag sizes
 * 
 */
  __pyx_v_n = 0;

  /* "MACS2/IO/cParser.pyx":737
 *             int x, header_len, nc, nlength
 *             int n = 0                   # successful read of tag size
 *             double s = 0                # sum of tag sizes             # <<<<<<<<<<<<<<
 * 
 *         if self.tag_size != -1:
 */
  __pyx_v_s = 0.0;

  /* "MACS2/IO/cParser.pyx":739
 *             double s = 0                # sum of tag sizes
 * 
 *         if self.tag_size != -1:             # <<<<<<<<<<<<<<
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size
 */
  __pyx_t_1 = ((__pyx_v_self->__pyx_base.tag_size != -1) != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":741
 *         if self.tag_size != -1:
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *         fseek = self.fhd.seek
 */
    __pyx_r = __pyx_v_self->__pyx_base.tag_size;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":743
 *             return self.tag_size
 * 
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fseek = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":744
 * 
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fread = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":745
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 *         # move to pos 4, there starts something
 *         fseek( 4 )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ftell = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":747
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 *         fseek( 4 )             # <<<<<<<<<<<<<<
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )
 */
  __pyx_t_2 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":748
 *         # move to pos 4, there starts something
 *         fseek( 4 )
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_header_len = __pyx_t_5;

  /* "MACS2/IO/cParser.pyx":749
 *         fseek( 4 )
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )             # <<<<<<<<<<<<<<
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]
 */
  __pyx_t_4 = PyInt_FromLong(__pyx_v_header_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Call(__pyx_v_ftell, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":751
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         for x in range( nc ):
 *             # read each chromosome name
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_nc = __pyx_t_5;

  /* "MACS2/IO/cParser.pyx":752
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]
 *         for x in range( nc ):             # <<<<<<<<<<<<<<
 *             # read each chromosome name
 *             nlength = unpack( '<i' , fread( 4 ) )[ 0 ]
 */
  __pyx_t_5 = __pyx_v_nc;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_x = __pyx_t_6;

    /* "MACS2/IO/cParser.pyx":754
 *         for x in range( nc ):
 *             # read each chromosome name
 *             nlength = unpack( '<i' , fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             # jump over chromosome size, we don't need it
 *             fread( nlength )
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_nlength = __pyx_t_7;

    /* "MACS2/IO/cParser.pyx":756
 *             nlength = unpack( '<i' , fread( 4 ) )[ 0 ]
 *             # jump over chromosome size, we don't need it
 *             fread( nlength )             # <<<<<<<<<<<<<<
 *             fseek( ftell() + 4 )
 *         while n < 10:
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_nlength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":757
 *             # jump over chromosome size, we don't need it
 *             fread( nlength )
 *             fseek( ftell() + 4 )             # <<<<<<<<<<<<<<
 *         while n < 10:
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 */
    __pyx_t_2 = PyObject_Call(__pyx_v_ftell, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "MACS2/IO/cParser.pyx":758
 *             fread( nlength )
 *             fseek( ftell() + 4 )
 *         while n < 10:             # <<<<<<<<<<<<<<
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             data = fread( entrylength )
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_n < 10) != 0);
    if (!__pyx_t_1) break;

    /* "MACS2/IO/cParser.pyx":759
 *             fseek( ftell() + 4 )
 *         while n < 10:
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             data = fread( entrylength )
 *             a = unpack( '<i', data[16:20] )[ 0 ]
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_v_entrylength);
    __pyx_v_entrylength = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "MACS2/IO/cParser.pyx":760
 *         while n < 10:
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             data = fread( entrylength )             # <<<<<<<<<<<<<<
 *             a = unpack( '<i', data[16:20] )[ 0 ]
 *             s += a
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_entrylength);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_entrylength);
    __Pyx_GIVEREF(__pyx_v_entrylength);
    __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_data);
    __pyx_v_data = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":761
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             data = fread( entrylength )
 *             a = unpack( '<i', data[16:20] )[ 0 ]             # <<<<<<<<<<<<<<
 *             s += a
 *             n += 1
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_data, 16, 20, NULL, NULL, &__pyx_k_slice_65, 1, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_a);
    __pyx_v_a = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":762
 *             data = fread( entrylength )
 *             a = unpack( '<i', data[16:20] )[ 0 ]
 *             s += a             # <<<<<<<<<<<<<<
 *             n += 1
 *         fseek( 0 )
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_v_a); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_s = __pyx_t_8;

    /* "MACS2/IO/cParser.pyx":763
 *             a = unpack( '<i', data[16:20] )[ 0 ]
 *             s += a
 *             n += 1             # <<<<<<<<<<<<<<
 *         fseek( 0 )
 *         self.tag_size = int( s/n )
 */
    __pyx_v_n = (__pyx_v_n + 1);
  }

  /* "MACS2/IO/cParser.pyx":764
 *             s += a
 *             n += 1
 *         fseek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = int( s/n )
 *         return self.tag_size
 */
  __pyx_t_4 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":765
 *             n += 1
 *         fseek( 0 )
 *         self.tag_size = int( s/n )             # <<<<<<<<<<<<<<
 *         return self.tag_size
 * 
 */
  if (unlikely(__pyx_v_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->__pyx_base.tag_size = ((int)(__pyx_v_s / __pyx_v_n));

  /* "MACS2/IO/cParser.pyx":766
 *         fseek( 0 )
 *         self.tag_size = int( s/n )
 *         return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple get_references( self ):
 */
  __pyx_r = __pyx_v_self->__pyx_base.tag_size;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("MACS2.IO.cParser.BAMParser.__tsize_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XDECREF(__pyx_v_entrylength);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":768
 *         return self.tag_size
 * 
 *     cpdef tuple get_references( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__get_references_w_pysam()
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_7get_references(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser_get_references(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_references", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_references); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_7get_references)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":769
 * 
 *     cpdef tuple get_references( self ):
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             return self.__get_references_w_pysam()
 *         else:
 */
  __pyx_t_3 = (HAS_PYSAM != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":770
 *     cpdef tuple get_references( self ):
 *         if HAS_PYSAM:
 *             return self.__get_references_w_pysam()             # <<<<<<<<<<<<<<
 *         else:
 *             return self.__get_references_wo_pysam()
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___get_references_w_pysam(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":772
 *             return self.__get_references_w_pysam()
 *         else:
 *             return self.__get_references_wo_pysam()             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple __get_references_w_pysam( self ):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___get_references_wo_pysam(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.get_references", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_7get_references(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_7get_references(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_references (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_6get_references(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":768
 *         return self.tag_size
 * 
 *     cpdef tuple get_references( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__get_references_w_pysam()
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_6get_references(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_references", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->get_references(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.get_references", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":774
 *             return self.__get_references_wo_pysam()
 * 
 *     cdef tuple __get_references_w_pysam( self ):             # <<<<<<<<<<<<<<
 *         """
 *         read in references from BAM header
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___get_references_w_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get_references_w_pysam", 0);

  /* "MACS2/IO/cParser.pyx":782
 *         """
 *         cdef:
 *             list references = []             # <<<<<<<<<<<<<<
 *             dict rlengths = {}
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":783
 *         cdef:
 *             list references = []
 *             dict rlengths = {}             # <<<<<<<<<<<<<<
 * 
 *         references = list(self.fhd.references)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_rlengths = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":785
 *             dict rlengths = {}
 * 
 *         references = list(self.fhd.references)             # <<<<<<<<<<<<<<
 *         rlengths = dict( zip( references, self.fhd.lengths ) )
 *         return (references, rlengths)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__references); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_references));
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":786
 * 
 *         references = list(self.fhd.references)
 *         rlengths = dict( zip( references, self.fhd.lengths ) )             # <<<<<<<<<<<<<<
 *         return (references, rlengths)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__lengths); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_references));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_references));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_references));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_rlengths));
  __pyx_v_rlengths = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":787
 *         references = list(self.fhd.references)
 *         rlengths = dict( zip( references, self.fhd.lengths ) )
 *         return (references, rlengths)             # <<<<<<<<<<<<<<
 * 
 *     cdef tuple __get_references_wo_pysam( self ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_references));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_references));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_references));
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__get_references_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":789
 *         return (references, rlengths)
 * 
 *     cdef tuple __get_references_wo_pysam( self ):             # <<<<<<<<<<<<<<
 *         """
 *         read in references from BAM header
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___get_references_wo_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  int __pyx_v_header_len;
  CYTHON_UNUSED int __pyx_v_x;
  int __pyx_v_nc;
  int __pyx_v_nlength;
  PyObject *__pyx_v_refname = 0;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get_references_wo_pysam", 0);

  /* "MACS2/IO/cParser.pyx":799
 *             int header_len, x, nc, nlength
 *             str refname
 *             list references = []             # <<<<<<<<<<<<<<
 *             dict rlengths = {}
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":800
 *             str refname
 *             list references = []
 *             dict rlengths = {}             # <<<<<<<<<<<<<<
 * 
 *         fseek = self.fhd.seek
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_rlengths = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":802
 *             dict rlengths = {}
 * 
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fseek = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":803
 * 
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fread = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":804
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 *         # move to pos 4, there starts something
 *         fseek(4)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ftell = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":806
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 *         fseek(4)             # <<<<<<<<<<<<<<
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":807
 *         # move to pos 4, there starts something
 *         fseek(4)
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_header_len = __pyx_t_4;

  /* "MACS2/IO/cParser.pyx":808
 *         fseek(4)
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )             # <<<<<<<<<<<<<<
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]
 */
  __pyx_t_3 = PyInt_FromLong(__pyx_v_header_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_Call(__pyx_v_ftell, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":810
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         for x in range( nc ):
 *             # read each chromosome name
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nc = __pyx_t_4;

  /* "MACS2/IO/cParser.pyx":811
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]
 *         for x in range( nc ):             # <<<<<<<<<<<<<<
 *             # read each chromosome name
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]
 */
  __pyx_t_4 = __pyx_v_nc;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_x = __pyx_t_5;

    /* "MACS2/IO/cParser.pyx":813
 *         for x in range( nc ):
 *             # read each chromosome name
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             refname = fread( nlength )[ :-1 ]
 *             references.append( refname )
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_nlength = __pyx_t_6;

    /* "MACS2/IO/cParser.pyx":814
 *             # read each chromosome name
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             refname = fread( nlength )[ :-1 ]             # <<<<<<<<<<<<<<
 *             references.append( refname )
 *             # don't jump over chromosome size
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_nlength); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __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 = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, -1, NULL, NULL, &__pyx_k_slice_71, 0, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_refname));
    __pyx_v_refname = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "MACS2/IO/cParser.pyx":815
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             refname = fread( nlength )[ :-1 ]
 *             references.append( refname )             # <<<<<<<<<<<<<<
 *             # don't jump over chromosome size
 *             # we can use it to avoid falling of chrom ends during peak calling
 */
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_references, ((PyObject *)__pyx_v_refname)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "MACS2/IO/cParser.pyx":818
 *             # don't jump over chromosome size
 *             # we can use it to avoid falling of chrom ends during peak calling
 *             rlengths[refname] = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         return (references, rlengths)
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(((PyObject *)__pyx_v_rlengths), ((PyObject *)__pyx_v_refname), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "MACS2/IO/cParser.pyx":819
 *             # we can use it to avoid falling of chrom ends during peak calling
 *             rlengths[refname] = unpack( '<i', fread( 4 ) )[ 0 ]
 *         return (references, rlengths)             # <<<<<<<<<<<<<<
 * 
 *     cpdef build_fwtrack ( self ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_references));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_references));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_references));
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)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("MACS2.IO.cParser.BAMParser.__get_references_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_refname);
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":821
 *         return (references, rlengths)
 * 
 *     cpdef build_fwtrack ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__build_fwtrack_w_pysam()
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_9build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser_build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_fwtrack", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__build_fwtrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_9build_fwtrack)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":822
 * 
 *     cpdef build_fwtrack ( self ):
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             return self.__build_fwtrack_w_pysam()
 *         else:
 */
  __pyx_t_3 = (HAS_PYSAM != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":823
 *     cpdef build_fwtrack ( self ):
 *         if HAS_PYSAM:
 *             return self.__build_fwtrack_w_pysam()             # <<<<<<<<<<<<<<
 *         else:
 *             return self.__build_fwtrack_wo_pysam()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___build_fwtrack_w_pysam(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":825
 *             return self.__build_fwtrack_w_pysam()
 *         else:
 *             return self.__build_fwtrack_wo_pysam()             # <<<<<<<<<<<<<<
 * 
 *     cdef __build_fwtrack_w_pysam ( self ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___build_fwtrack_wo_pysam(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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_AddTraceback("MACS2.IO.cParser.BAMParser.build_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_9build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_9build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_8build_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":821
 *         return (references, rlengths)
 * 
 *     cpdef build_fwtrack ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__build_fwtrack_w_pysam()
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_8build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_fwtrack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->build_fwtrack(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.build_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":827
 *             return self.__build_fwtrack_wo_pysam()
 * 
 *     cdef __build_fwtrack_w_pysam ( self ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int i = 0
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___build_fwtrack_w_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  int __pyx_v_chrid;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  PyObject *__pyx_v_fwtrack = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__build_fwtrack_w_pysam", 0);

  /* "MACS2/IO/cParser.pyx":829
 *     cdef __build_fwtrack_w_pysam ( self ):
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int fpos, strand, chrid
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":830
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int fpos, strand, chrid
 *             list references
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":835
 *             dict rlengths
 * 
 *         fwtrack = FWTrackIII()             # <<<<<<<<<<<<<<
 *         self.fhd.reset()
 *         references, rlengths = self.get_references()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__FWTrackIII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fwtrack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":836
 * 
 *         fwtrack = FWTrackIII()
 *         self.fhd.reset()             # <<<<<<<<<<<<<<
 *         references, rlengths = self.get_references()
 *         while True:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__reset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":837
 *         fwtrack = FWTrackIII()
 *         self.fhd.reset()
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         while True:
 *             try:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->get_references(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":838
 *         self.fhd.reset()
 *         references, rlengths = self.get_references()
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 a  =  self.fhd.next()
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":839
 *         references, rlengths = self.get_references()
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 a  =  self.fhd.next()
 *             except StopIteration:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":840
 *         while True:
 *             try:
 *                 a  =  self.fhd.next()             # <<<<<<<<<<<<<<
 *             except StopIteration:
 *                 break
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__next); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_v_a);
        __pyx_v_a = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":841
 *             try:
 *                 a  =  self.fhd.next()
 *             except StopIteration:             # <<<<<<<<<<<<<<
 *                 break
 *             chrid = a.tid
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__build_fwtrack_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);

        /* "MACS2/IO/cParser.pyx":842
 *                 a  =  self.fhd.next()
 *             except StopIteration:
 *                 break             # <<<<<<<<<<<<<<
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 */
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":843
 *             except StopIteration:
 *                 break
 *             chrid = a.tid             # <<<<<<<<<<<<<<
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 *                 fpos = -1
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_chrid = __pyx_t_9;

    /* "MACS2/IO/cParser.pyx":844
 *                 break
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):             # <<<<<<<<<<<<<<
 *                 fpos = -1
 *             else:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_unmapped); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_10) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_paired); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_11) {
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_proper_pair); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_13 = (!__pyx_t_12);
        if (!__pyx_t_13) {
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_read2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_14 = __pyx_t_12;
        } else {
          __pyx_t_14 = __pyx_t_13;
        }
        __pyx_t_13 = __pyx_t_14;
      } else {
        __pyx_t_13 = __pyx_t_11;
      }
      __pyx_t_11 = __pyx_t_13;
    } else {
      __pyx_t_11 = __pyx_t_10;
    }
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":845
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 *                 fpos = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 if a.is_reverse:
 */
      __pyx_v_fpos = -1;
      goto __pyx_L17;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":847
 *                 fpos = -1
 *             else:
 *                 if a.is_reverse:             # <<<<<<<<<<<<<<
 *                     strand = 1              # minus strand
 *                     fpos = a.pos + a.rlen     # rightmost position
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_reverse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_11) {

        /* "MACS2/IO/cParser.pyx":848
 *             else:
 *                 if a.is_reverse:
 *                     strand = 1              # minus strand             # <<<<<<<<<<<<<<
 *                     fpos = a.pos + a.rlen     # rightmost position
 *                 else:
 */
        __pyx_v_strand = 1;

        /* "MACS2/IO/cParser.pyx":849
 *                 if a.is_reverse:
 *                     strand = 1              # minus strand
 *                     fpos = a.pos + a.rlen     # rightmost position             # <<<<<<<<<<<<<<
 *                 else:
 *                     strand = 0              # plus strand
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__rlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_fpos = __pyx_t_9;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":851
 *                     fpos = a.pos + a.rlen     # rightmost position
 *                 else:
 *                     strand = 0              # plus strand             # <<<<<<<<<<<<<<
 *                     fpos = a.pos
 *             i+=1
 */
        __pyx_v_strand = 0;

        /* "MACS2/IO/cParser.pyx":852
 *                 else:
 *                     strand = 0              # plus strand
 *                     fpos = a.pos             # <<<<<<<<<<<<<<
 *             i+=1
 *             if i == 1000000:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_fpos = __pyx_t_9;
      }
      __pyx_L18:;
    }
    __pyx_L17:;

    /* "MACS2/IO/cParser.pyx":853
 *                     strand = 0              # plus strand
 *                     fpos = a.pos
 *             i+=1             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":854
 *                     fpos = a.pos
 *             i+=1
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_11 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":855
 *             i+=1
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":856
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i = 0
 *             if fpos >= 0:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "MACS2/IO/cParser.pyx":857
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0             # <<<<<<<<<<<<<<
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 */
      __pyx_v_i = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "MACS2/IO/cParser.pyx":858
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 *             if fpos >= 0:             # <<<<<<<<<<<<<<
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 */
    __pyx_t_11 = ((__pyx_v_fpos >= 0) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":859
 *                 i = 0
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         fwtrack.finalize()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_chrid, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":860
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "MACS2/IO/cParser.pyx":861
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack
 */
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_4 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":862
 *         self.fhd.close()
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":863
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     cdef __build_fwtrack_wo_pysam ( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__build_fwtrack_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_fwtrack);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":865
 *         return fwtrack
 * 
 *     cdef __build_fwtrack_wo_pysam ( self ):             # <<<<<<<<<<<<<<
 *         """Build FWTrackIII from all lines, return a FWTrackIII object.
 * 
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___build_fwtrack_wo_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_entrylength;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  int __pyx_v_chrid;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  PyObject *__pyx_v_fwtrack = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__build_fwtrack_wo_pysam", 0);

  /* "MACS2/IO/cParser.pyx":871
 *         """
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int entrylength, fpos, strand, chrid
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":872
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int entrylength, fpos, strand, chrid
 *             list references
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":877
 *             dict rlengths
 * 
 *         fwtrack = FWTrackIII()             # <<<<<<<<<<<<<<
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__FWTrackIII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fwtrack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":878
 * 
 *         fwtrack = FWTrackIII()
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->get_references(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":879
 *         fwtrack = FWTrackIII()
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fseek = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":880
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fread = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":881
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ftell = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":883
 *         ftell = self.fhd.tell
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":884
 * 
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":885
 *         while True:
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             except struct.error:
 *                 break
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_60));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_entrylength = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":886
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:             # <<<<<<<<<<<<<<
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__build_fwtrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);

        /* "MACS2/IO/cParser.pyx":887
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:
 *                 break             # <<<<<<<<<<<<<<
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1
 */
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":888
 *             except struct.error:
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if i == 1000000:
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_entrylength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___fw_binary_parse(__pyx_v_self, __pyx_t_2, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyTuple_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_4 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_5 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L18_unpacking_done:;
    }
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_chrid = __pyx_t_9;
    __pyx_v_fpos = __pyx_t_11;
    __pyx_v_strand = __pyx_t_12;

    /* "MACS2/IO/cParser.pyx":889
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":890
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_13 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":891
 *             i+=1
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":892
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i = 0
 *             if fpos >= 0:
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":893
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0             # <<<<<<<<<<<<<<
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 */
      __pyx_v_i = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "MACS2/IO/cParser.pyx":894
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 *             if fpos >= 0:             # <<<<<<<<<<<<<<
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 */
    __pyx_t_13 = ((__pyx_v_fpos >= 0) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":895
 *                 i = 0
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         fwtrack.finalize()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_chrid, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":896
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "MACS2/IO/cParser.pyx":897
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":898
 *         self.fhd.close()
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":899
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     cpdef append_fwtrack ( self, fwtrack ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__build_fwtrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_fwtrack);
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":901
 *         return fwtrack
 * 
 *     cpdef append_fwtrack ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__append_fwtrack_w_pysam( fwtrack )
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_11append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser_append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_fwtrack", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append_fwtrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_11append_fwtrack)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_fwtrack);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fwtrack);
      __Pyx_GIVEREF(__pyx_v_fwtrack);
      __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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":902
 * 
 *     cpdef append_fwtrack ( self, fwtrack ):
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             return self.__append_fwtrack_w_pysam( fwtrack )
 *         else:
 */
  __pyx_t_4 = (HAS_PYSAM != 0);
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":903
 *     cpdef append_fwtrack ( self, fwtrack ):
 *         if HAS_PYSAM:
 *             return self.__append_fwtrack_w_pysam( fwtrack )             # <<<<<<<<<<<<<<
 *         else:
 *             return self.__append_fwtrack_wo_pysam( fwtrack )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___append_fwtrack_w_pysam(__pyx_v_self, __pyx_v_fwtrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":905
 *             return self.__append_fwtrack_w_pysam( fwtrack )
 *         else:
 *             return self.__append_fwtrack_wo_pysam( fwtrack )             # <<<<<<<<<<<<<<
 * 
 *     cdef __append_fwtrack_w_pysam ( self, fwtrack ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___append_fwtrack_wo_pysam(__pyx_v_self, __pyx_v_fwtrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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("MACS2.IO.cParser.BAMParser.append_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_11append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_11append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_10append_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self), ((PyObject *)__pyx_v_fwtrack));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":901
 *         return fwtrack
 * 
 *     cpdef append_fwtrack ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__append_fwtrack_w_pysam( fwtrack )
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_10append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_fwtrack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->append_fwtrack(__pyx_v_self, __pyx_v_fwtrack, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.append_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":907
 *             return self.__append_fwtrack_wo_pysam( fwtrack )
 * 
 *     cdef __append_fwtrack_w_pysam ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int i = 0
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___append_fwtrack_w_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  int __pyx_v_chrid;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__append_fwtrack_w_pysam", 0);

  /* "MACS2/IO/cParser.pyx":909
 *     cdef __append_fwtrack_w_pysam ( self, fwtrack ):
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int fpos, strand, chrid
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":910
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int fpos, strand, chrid
 *             list references
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":915
 *             dict rlengths
 * 
 *         self.fhd.reset()             # <<<<<<<<<<<<<<
 *         references, rlengths = self.get_references()
 *         while True:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__reset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __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_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":916
 * 
 *         self.fhd.reset()
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         while True:
 *             try:
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->get_references(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":917
 *         self.fhd.reset()
 *         references, rlengths = self.get_references()
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 a  =  self.fhd.next()
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":918
 *         references, rlengths = self.get_references()
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 a  =  self.fhd.next()
 *             except StopIteration:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":919
 *         while True:
 *             try:
 *                 a  =  self.fhd.next()             # <<<<<<<<<<<<<<
 *             except StopIteration:
 *                 break
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__next); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_v_a);
        __pyx_v_a = __pyx_t_3;
        __pyx_t_3 = 0;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":920
 *             try:
 *                 a  =  self.fhd.next()
 *             except StopIteration:             # <<<<<<<<<<<<<<
 *                 break
 *             chrid = a.tid
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__append_fwtrack_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);

        /* "MACS2/IO/cParser.pyx":921
 *                 a  =  self.fhd.next()
 *             except StopIteration:
 *                 break             # <<<<<<<<<<<<<<
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 */
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":922
 *             except StopIteration:
 *                 break
 *             chrid = a.tid             # <<<<<<<<<<<<<<
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 *                 fpos = -1
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__tid); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_chrid = __pyx_t_9;

    /* "MACS2/IO/cParser.pyx":923
 *                 break
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):             # <<<<<<<<<<<<<<
 *                 fpos = -1
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_unmapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_10) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_paired); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_11) {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_proper_pair); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_13 = (!__pyx_t_12);
        if (!__pyx_t_13) {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_read2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_14 = __pyx_t_12;
        } else {
          __pyx_t_14 = __pyx_t_13;
        }
        __pyx_t_13 = __pyx_t_14;
      } else {
        __pyx_t_13 = __pyx_t_11;
      }
      __pyx_t_11 = __pyx_t_13;
    } else {
      __pyx_t_11 = __pyx_t_10;
    }
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":924
 *             chrid = a.tid
 *             if a.is_unmapped or (a.is_paired and (not a.is_proper_pair or a.is_read2)):
 *                 fpos = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 if a.is_reverse:
 */
      __pyx_v_fpos = -1;
      goto __pyx_L17;
    }
    /*else*/ {

      /* "MACS2/IO/cParser.pyx":926
 *                 fpos = -1
 *             else:
 *                 if a.is_reverse:             # <<<<<<<<<<<<<<
 *                     strand = 1              # minus strand
 *                     fpos = a.pos + a.rlen     # rightmost position
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__is_reverse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_11) {

        /* "MACS2/IO/cParser.pyx":927
 *             else:
 *                 if a.is_reverse:
 *                     strand = 1              # minus strand             # <<<<<<<<<<<<<<
 *                     fpos = a.pos + a.rlen     # rightmost position
 *                 else:
 */
        __pyx_v_strand = 1;

        /* "MACS2/IO/cParser.pyx":928
 *                 if a.is_reverse:
 *                     strand = 1              # minus strand
 *                     fpos = a.pos + a.rlen     # rightmost position             # <<<<<<<<<<<<<<
 *                 else:
 *                     strand = 0              # plus strand
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__rlen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_fpos = __pyx_t_9;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":930
 *                     fpos = a.pos + a.rlen     # rightmost position
 *                 else:
 *                     strand = 0              # plus strand             # <<<<<<<<<<<<<<
 *                     fpos = a.pos
 *             i+=1
 */
        __pyx_v_strand = 0;

        /* "MACS2/IO/cParser.pyx":931
 *                 else:
 *                     strand = 0              # plus strand
 *                     fpos = a.pos             # <<<<<<<<<<<<<<
 *             i+=1
 *             if i == 1000000:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_a, __pyx_n_s__pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_fpos = __pyx_t_9;
      }
      __pyx_L18:;
    }
    __pyx_L17:;

    /* "MACS2/IO/cParser.pyx":932
 *                     strand = 0              # plus strand
 *                     fpos = a.pos
 *             i+=1             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":933
 *                     fpos = a.pos
 *             i+=1
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_11 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":934
 *             i+=1
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":935
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i = 0
 *             if fpos >= 0:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":936
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0             # <<<<<<<<<<<<<<
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 */
      __pyx_v_i = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "MACS2/IO/cParser.pyx":937
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 *             if fpos >= 0:             # <<<<<<<<<<<<<<
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 */
    __pyx_t_11 = ((__pyx_v_fpos >= 0) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":938
 *                 i = 0
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         fwtrack.finalize()
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_chrid, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __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_15)); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":939
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         fwtrack.finalize()
 *         if isinstance( fwtrack.rlengths, dict ):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

  /* "MACS2/IO/cParser.pyx":940
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         if isinstance( fwtrack.rlengths, dict ):
 *             fwtrack.set_rlengths(rlengths)
 */
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_4 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":941
 *         self.fhd.close()
 *         fwtrack.finalize()
 *         if isinstance( fwtrack.rlengths, dict ):             # <<<<<<<<<<<<<<
 *             fwtrack.set_rlengths(rlengths)
 *         return fwtrack
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__rlengths); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = PyDict_Check(__pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = (__pyx_t_11 != 0);
  if (__pyx_t_10) {

    /* "MACS2/IO/cParser.pyx":942
 *         fwtrack.finalize()
 *         if isinstance( fwtrack.rlengths, dict ):
 *             fwtrack.set_rlengths(rlengths)             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
    PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_rlengths));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "MACS2/IO/cParser.pyx":943
 *         if isinstance( fwtrack.rlengths, dict ):
 *             fwtrack.set_rlengths(rlengths)
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     cdef __append_fwtrack_wo_pysam ( self, fwtrack ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__append_fwtrack_w_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":945
 *         return fwtrack
 * 
 *     cdef __append_fwtrack_wo_pysam ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         """Build FWTrackIII from all lines, return a FWTrackIII object.
 * 
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___append_fwtrack_wo_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_entrylength;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  int __pyx_v_chrid;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  CYTHON_UNUSED PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__append_fwtrack_wo_pysam", 0);

  /* "MACS2/IO/cParser.pyx":951
 *         """
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int entrylength, fpos, strand, chrid
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":952
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int entrylength, fpos, strand, chrid
 *             list references
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":957
 *             dict rlengths
 * 
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->get_references(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":958
 * 
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fseek = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":959
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fread = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":960
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 * 
 *         while True:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ftell = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":962
 *         ftell = self.fhd.tell
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":963
 * 
 *         while True:
 *             try:             # <<<<<<<<<<<<<<
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {

        /* "MACS2/IO/cParser.pyx":964
 *         while True:
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             except struct.error:
 *                 break
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __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 = 964; __pyx_clineno = __LINE__; goto __pyx_L7_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_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_entrylength = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "MACS2/IO/cParser.pyx":965
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:             # <<<<<<<<<<<<<<
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__append_fwtrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_1);

        /* "MACS2/IO/cParser.pyx":966
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             except struct.error:
 *                 break             # <<<<<<<<<<<<<<
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1
 */
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":967
 *             except struct.error:
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if i == 1000000:
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_entrylength); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __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 = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___fw_binary_parse(__pyx_v_self, __pyx_t_1, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_4 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_5 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L18_unpacking_done:;
    }
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_chrid = __pyx_t_9;
    __pyx_v_fpos = __pyx_t_11;
    __pyx_v_strand = __pyx_t_12;

    /* "MACS2/IO/cParser.pyx":968
 *                 break
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":969
 *             ( chrid, fpos, strand ) = self.__fw_binary_parse( fread( entrylength ) )
 *             i+=1
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_13 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":970
 *             i+=1
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":971
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i = 0
 *             if fpos >= 0:
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":972
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0             # <<<<<<<<<<<<<<
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 */
      __pyx_v_i = 0;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "MACS2/IO/cParser.pyx":973
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i = 0
 *             if fpos >= 0:             # <<<<<<<<<<<<<<
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 */
    __pyx_t_13 = ((__pyx_v_fpos >= 0) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":974
 *                 i = 0
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         fwtrack.finalize()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_chrid, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":975
 *             if fpos >= 0:
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "MACS2/IO/cParser.pyx":976
 *                 fwtrack.add_loc( references[ chrid ], fpos, strand )
 *         self.fhd.close()
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":977
 *         self.fhd.close()
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __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_10)); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":978
 *         fwtrack.finalize()
 *         fwtrack.set_rlengths( rlengths )
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple __fw_binary_parse (self, data ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__append_fwtrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":980
 *         return fwtrack
 * 
 *     cpdef tuple __fw_binary_parse (self, data ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int thisref, thisstart, thisstrand
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_13__fw_binary_parse(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_9BAMParser___fw_binary_parse(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch) {
  int __pyx_v_thisref;
  int __pyx_v_thisstart;
  int __pyx_v_thisstrand;
  CYTHON_UNUSED short __pyx_v_cigar;
  short __pyx_v_bwflag;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  short __pyx_t_9;
  short __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_binary_parse", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____fw_binary_parse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_13__fw_binary_parse)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_data);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
      __Pyx_GIVEREF(__pyx_v_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 = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":986
 * 
 *         # we skip lot of the available information in data (i.e. tag name, quality etc etc)
 *         if not data: return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_75));
    __pyx_r = __pyx_k_tuple_75;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":988
 *         if not data: return ( -1, -1, -1 )
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]             # <<<<<<<<<<<<<<
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_data, 0, 4, NULL, NULL, &__pyx_k_slice_76, 1, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __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 = 988; __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_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_thisref = __pyx_t_6;

  /* "MACS2/IO/cParser.pyx":989
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]             # <<<<<<<<<<<<<<
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_data, 4, 8, NULL, NULL, &__pyx_k_slice_77, 1, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_thisstart = __pyx_t_6;

  /* "MACS2/IO/cParser.pyx":990
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )             # <<<<<<<<<<<<<<
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_data, 12, 16, NULL, NULL, &__pyx_k_slice_79, 1, 1, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_78));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_78));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_78));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __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 = 990; __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;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_9 = __Pyx_PyInt_AsShort(__pyx_t_2); if (unlikely((__pyx_t_9 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyInt_AsShort(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_cigar = __pyx_t_9;
  __pyx_v_bwflag = __pyx_t_10;

  /* "MACS2/IO/cParser.pyx":991
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:             # <<<<<<<<<<<<<<
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence
 *         if bwflag & 1:
 */
  __pyx_t_5 = ((__pyx_v_bwflag & 4) != 0);
  if (!__pyx_t_5) {
    __pyx_t_4 = ((__pyx_v_bwflag & 512) != 0);
    if (!__pyx_t_4) {
      __pyx_t_11 = ((__pyx_v_bwflag & 1024) != 0);
      __pyx_t_12 = __pyx_t_11;
    } else {
      __pyx_t_12 = __pyx_t_4;
    }
    __pyx_t_4 = __pyx_t_12;
  } else {
    __pyx_t_4 = __pyx_t_5;
  }
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":992
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_80));
    __pyx_r = __pyx_k_tuple_80;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "MACS2/IO/cParser.pyx":993
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence
 *         if bwflag & 1:             # <<<<<<<<<<<<<<
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 */
  __pyx_t_4 = ((__pyx_v_bwflag & 1) != 0);
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":996
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:             # <<<<<<<<<<<<<<
 *                 return ( -1, -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 */
    __pyx_t_4 = ((!((__pyx_v_bwflag & 2) != 0)) != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":997
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return ( -1, -1, -1 )   # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return ( -1, -1, -1 )   # the mate is unmapped
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_81));
      __pyx_r = __pyx_k_tuple_81;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":998
 *             if not bwflag & 2:
 *                 return ( -1, -1, -1 )   # not a proper pair
 *             if bwflag & 8:             # <<<<<<<<<<<<<<
 *                 return ( -1, -1, -1 )   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 */
    __pyx_t_4 = ((__pyx_v_bwflag & 8) != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":999
 *                 return ( -1, -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 *                 return ( -1, -1, -1 )   # the mate is unmapped             # <<<<<<<<<<<<<<
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_82));
      __pyx_r = __pyx_k_tuple_82;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "MACS2/IO/cParser.pyx":1001
 *                 return ( -1, -1, -1 )   # the mate is unmapped
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:             # <<<<<<<<<<<<<<
 *                 # this is not the first read in a pair
 *                 return ( -1, -1, -1 )
 */
    __pyx_t_4 = ((__pyx_v_bwflag & 128) != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":1003
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 *             # end of the patch
 *         # In case of paired-end we have now skipped all possible "bad" pairs
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __Pyx_INCREF(((PyObject *)__pyx_k_tuple_83));
      __pyx_r = __pyx_k_tuple_83;
      goto __pyx_L0;
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "MACS2/IO/cParser.pyx":1010
 *         # start position... hope I'm right!
 * 	# l = unpack( '<i', data[ 16:20 ] )[ 0 ]
 *         if bwflag & 16:             # <<<<<<<<<<<<<<
 *             thisstrand = 1
 *             thisstart = thisstart + unpack( '<i', data[ 16:20 ] )[ 0 ]	#reverse strand should be shifted len(query) bp
 */
  __pyx_t_4 = ((__pyx_v_bwflag & 16) != 0);
  if (__pyx_t_4) {

    /* "MACS2/IO/cParser.pyx":1011
 * 	# l = unpack( '<i', data[ 16:20 ] )[ 0 ]
 *         if bwflag & 16:
 *             thisstrand = 1             # <<<<<<<<<<<<<<
 *             thisstart = thisstart + unpack( '<i', data[ 16:20 ] )[ 0 ]	#reverse strand should be shifted len(query) bp
 *         else:
 */
    __pyx_v_thisstrand = 1;

    /* "MACS2/IO/cParser.pyx":1012
 *         if bwflag & 16:
 *             thisstrand = 1
 *             thisstart = thisstart + unpack( '<i', data[ 16:20 ] )[ 0 ]	#reverse strand should be shifted len(query) bp             # <<<<<<<<<<<<<<
 *         else:
 *             thisstrand = 0
 */
    __pyx_t_3 = PyInt_FromLong(__pyx_v_thisstart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_data, 16, 20, NULL, NULL, &__pyx_k_slice_84, 1, 1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_thisstart = __pyx_t_6;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":1014
 *             thisstart = thisstart + unpack( '<i', data[ 16:20 ] )[ 0 ]	#reverse strand should be shifted len(query) bp
 *         else:
 *             thisstrand = 0             # <<<<<<<<<<<<<<
 * 
 *         return ( thisref, thisstart, thisstrand )
 */
    __pyx_v_thisstrand = 0;
  }
  __pyx_L11:;

  /* "MACS2/IO/cParser.pyx":1016
 *             thisstrand = 0
 * 
 *         return ( thisref, thisstart, thisstrand )             # <<<<<<<<<<<<<<
 * 
 * cdef class BAMPEParser(BAMParser):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_2 = PyInt_FromLong(__pyx_v_thisref); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyInt_FromLong(__pyx_v_thisstart); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_thisstrand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_7 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)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_7);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__fw_binary_parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_13__fw_binary_parse(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_13__fw_binary_parse(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_binary_parse (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_9BAMParser_12__fw_binary_parse(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self), ((PyObject *)__pyx_v_data));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":980
 *         return fwtrack
 * 
 *     cpdef tuple __fw_binary_parse (self, data ):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int thisref, thisstart, thisstrand
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_9BAMParser_12__fw_binary_parse(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_binary_parse", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self->__pyx_vtab)->__pyx___fw_binary_parse(__pyx_v_self, __pyx_v_data, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMParser.__fw_binary_parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1045
 *     cdef public int d
 * 
 *     cpdef build_petrack ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__build_petrack_w_pysam()
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1build_petrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser_build_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_petrack", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__build_petrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1build_petrack)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":1046
 * 
 *     cpdef build_petrack ( self ):
 *         if HAS_PYSAM:             # <<<<<<<<<<<<<<
 *             return self.__build_petrack_w_pysam()
 *         else:
 */
  __pyx_t_3 = (HAS_PYSAM != 0);
  if (__pyx_t_3) {

    /* "MACS2/IO/cParser.pyx":1047
 *     cpdef build_petrack ( self ):
 *         if HAS_PYSAM:
 *             return self.__build_petrack_w_pysam()             # <<<<<<<<<<<<<<
 *         else:
 *             return self.__build_petrack_wo_pysam()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx___build_petrack_w_pysam(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":1049
 *             return self.__build_petrack_w_pysam()
 *         else:
 *             return self.__build_petrack_wo_pysam()             # <<<<<<<<<<<<<<
 * 
 *     cdef __build_petrack_w_pysam ( self ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx___build_petrack_wo_pysam(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __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_AddTraceback("MACS2.IO.cParser.BAMPEParser.build_petrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1build_petrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1build_petrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_petrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_build_petrack(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1045
 *     cdef public int d
 * 
 *     cpdef build_petrack ( self ):             # <<<<<<<<<<<<<<
 *         if HAS_PYSAM:
 *             return self.__build_petrack_w_pysam()
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_build_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_petrack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->build_petrack(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.build_petrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1051
 *             return self.__build_petrack_wo_pysam()
 * 
 *     cdef __build_petrack_w_pysam ( self ):             # <<<<<<<<<<<<<<
 *         return
 * #         cdef:
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___build_petrack_w_pysam(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__build_petrack_w_pysam", 0);

  /* "MACS2/IO/cParser.pyx":1052
 * 
 *     cdef __build_petrack_w_pysam ( self ):
 *         return             # <<<<<<<<<<<<<<
 * #         cdef:
 * #             int i = 0
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1129
 * 
 * 
 *     cdef __build_petrack_wo_pysam ( self ):             # <<<<<<<<<<<<<<
 *         """Build FWTrackIII from all lines, return a FWTrackIII object.
 *         """
 */

static PyObject *__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___build_petrack_wo_pysam(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_entrylength;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  float __pyx_v_d;
  char *__pyx_v_rawread;
  struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed __pyx_v_read;
  PyObject *__pyx_v_petrack = NULL;
  PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_v_add_loc = NULL;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_v_unpack = NULL;
  PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char *__pyx_t_10;
  int __pyx_t_11;
  unsigned int __pyx_t_12;
  float __pyx_t_13;
  long __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__build_petrack_wo_pysam", 0);

  /* "MACS2/IO/cParser.pyx":1133
 *         """
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int entrylength, fpos, chrid, tlen
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":1134
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int entrylength, fpos, chrid, tlen
 *             int *asint
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":1139
 *             list references
 *             dict rlengths
 *             float d = 0.0             # <<<<<<<<<<<<<<
 *             char *rawread, *rawentrylength
 *             _BAMPEParsed read
 */
  __pyx_v_d = 0.0;

  /* "MACS2/IO/cParser.pyx":1143
 *             _BAMPEParsed read
 * 
 *         petrack = PETrackI()             # <<<<<<<<<<<<<<
 * 
 *         references, rlengths = self.get_references()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__PETrackI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_petrack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1145
 *         petrack = PETrackI()
 * 
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 */
  __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_references(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyTuple_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1146
 * 
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fseek = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1147
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_fread = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1148
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 * 
 *         # for convenience, only count valid pairs
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ftell = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1151
 * 
 *         # for convenience, only count valid pairs
 *         add_loc = petrack.add_loc             # <<<<<<<<<<<<<<
 *         info = logging.info
 *         unpack = struct.unpack
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_add_loc = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1152
 *         # for convenience, only count valid pairs
 *         add_loc = petrack.add_loc
 *         info = logging.info             # <<<<<<<<<<<<<<
 *         unpack = struct.unpack
 *         err = struct.error
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_info = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1153
 *         add_loc = petrack.add_loc
 *         info = logging.info
 *         unpack = struct.unpack             # <<<<<<<<<<<<<<
 *         err = struct.error
 *         while True:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__unpack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_unpack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1154
 *         info = logging.info
 *         unpack = struct.unpack
 *         err = struct.error             # <<<<<<<<<<<<<<
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_err = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1155
 *         unpack = struct.unpack
 *         err = struct.error
 *         while True:             # <<<<<<<<<<<<<<
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":1156
 *         err = struct.error
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]             # <<<<<<<<<<<<<<
 *             except err: break
 *             rawread = <bytes>fread(32)
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {
        __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_entrylength = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "MACS2/IO/cParser.pyx":1157
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break             # <<<<<<<<<<<<<<
 *             rawread = <bytes>fread(32)
 * #            rawread = <bytes>fread(entrylength)
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_v_err);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.__build_petrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_1);
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":1158
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 *             rawread = <bytes>fread(32)             # <<<<<<<<<<<<<<
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 */
    __pyx_t_1 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_rawread = __pyx_t_10;

    /* "MACS2/IO/cParser.pyx":1160
 *             rawread = <bytes>fread(32)
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)             # <<<<<<<<<<<<<<
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue
 */
    __pyx_v_read = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx___pe_binary_parse(__pyx_v_self, __pyx_v_rawread);

    /* "MACS2/IO/cParser.pyx":1161
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 *             fseek(entrylength - 32, 1)             # <<<<<<<<<<<<<<
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 */
    __pyx_t_1 = PyInt_FromLong((__pyx_v_entrylength - 32)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":1162
 *             read = self.__pe_binary_parse(rawread)
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue             # <<<<<<<<<<<<<<
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 *             i+=1
 */
    __pyx_t_11 = ((__pyx_v_read.ref == -1) != 0);
    if (__pyx_t_11) {
      goto __pyx_L5_continue;
      goto __pyx_L17;
    }
    __pyx_L17:;

    /* "MACS2/IO/cParser.pyx":1163
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size             # <<<<<<<<<<<<<<
 *             i+=1
 * 
 */
    __pyx_t_12 = __Pyx_abs_int(__pyx_v_read.tlen); 
    __pyx_t_13 = ((__pyx_v_d * __pyx_v_i) + __pyx_t_12);
    __pyx_t_14 = (__pyx_v_i + 1);
    if (unlikely(__pyx_t_14 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_d = (__pyx_t_13 / __pyx_t_14);

    /* "MACS2/IO/cParser.pyx":1164
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 *             i+=1             # <<<<<<<<<<<<<<
 * 
 *             if i == 1000000:
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":1166
 *             i+=1
 * 
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 info(" %d" % (m*1000000))
 */
    __pyx_t_11 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":1167
 * 
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 info(" %d" % (m*1000000))
 *                 i=0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":1168
 *             if i == 1000000:
 *                 m += 1
 *                 info(" %d" % (m*1000000))             # <<<<<<<<<<<<<<
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 */
      __pyx_t_1 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_v_info, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "MACS2/IO/cParser.pyx":1169
 *                 m += 1
 *                 info(" %d" % (m*1000000))
 *                 i=0             # <<<<<<<<<<<<<<
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i
 */
      __pyx_v_i = 0;
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "MACS2/IO/cParser.pyx":1170
 *                 info(" %d" % (m*1000000))
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)             # <<<<<<<<<<<<<<
 *         self.n = m * 1000000 + i
 *         self.d = int(d)
 */
    if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_read.ref, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_read.start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyInt_FromLong((__pyx_v_read.start + __pyx_v_read.tlen)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_add_loc, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_L5_continue:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":1171
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i             # <<<<<<<<<<<<<<
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 */
  __pyx_v_self->n = ((__pyx_v_m * 1000000) + __pyx_v_i);

  /* "MACS2/IO/cParser.pyx":1172
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i
 *         self.d = int(d)             # <<<<<<<<<<<<<<
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()
 */
  __pyx_v_self->d = ((int)__pyx_v_d);

  /* "MACS2/IO/cParser.pyx":1173
 *         self.n = m * 1000000 + i
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         petrack.finalize()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_d >= 0.0) != 0))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_87));
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "MACS2/IO/cParser.pyx":1174
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __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 = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":1175
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()
 *         petrack.finalize()             # <<<<<<<<<<<<<<
 *         petrack.set_rlengths( rlengths )
 *         return petrack
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __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 = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1176
 *         self.fhd.close()
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )             # <<<<<<<<<<<<<<
 *         return petrack
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1177
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )
 *         return petrack             # <<<<<<<<<<<<<<
 * 
 *     cpdef append_petrack (self, petrack):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_petrack);
  __pyx_r = __pyx_v_petrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.__build_petrack_wo_pysam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_petrack);
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XDECREF(__pyx_v_add_loc);
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_unpack);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1179
 *         return petrack
 * 
 *     cpdef append_petrack (self, petrack):             # <<<<<<<<<<<<<<
 *         """Build PETrackI from all lines, return a PETrackI object.
 *         """
 */

static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_3append_petrack(PyObject *__pyx_v_self, PyObject *__pyx_v_petrack); /*proto*/
static PyObject *__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser_append_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_petrack, int __pyx_skip_dispatch) {
  int __pyx_v_i;
  int __pyx_v_m;
  int __pyx_v_entrylength;
  PyObject *__pyx_v_references = 0;
  PyObject *__pyx_v_rlengths = 0;
  float __pyx_v_d;
  char *__pyx_v_rawread;
  struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed __pyx_v_read;
  PyObject *__pyx_v_fseek = NULL;
  PyObject *__pyx_v_fread = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_ftell = NULL;
  PyObject *__pyx_v_add_loc = NULL;
  PyObject *__pyx_v_info = NULL;
  PyObject *__pyx_v_unpack = NULL;
  PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char *__pyx_t_10;
  int __pyx_t_11;
  unsigned int __pyx_t_12;
  float __pyx_t_13;
  long __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_petrack", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append_petrack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_3append_petrack)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_petrack);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_petrack);
      __Pyx_GIVEREF(__pyx_v_petrack);
      __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 = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "MACS2/IO/cParser.pyx":1183
 *         """
 *         cdef:
 *             int i = 0             # <<<<<<<<<<<<<<
 *             int m = 0
 *             int entrylength, fpos, chrid, tlen
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":1184
 *         cdef:
 *             int i = 0
 *             int m = 0             # <<<<<<<<<<<<<<
 *             int entrylength, fpos, chrid, tlen
 *             int *asint
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":1189
 *             list references
 *             dict rlengths
 *             float d = 0.0             # <<<<<<<<<<<<<<
 *             char *rawread, *rawentrylength
 *             _BAMPEParsed read
 */
  __pyx_v_d = 0.0;

  /* "MACS2/IO/cParser.pyx":1193
 *             _BAMPEParsed read
 * 
 *         references, rlengths = self.get_references()             # <<<<<<<<<<<<<<
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_references(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)__pyx_v_self), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_references = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_rlengths = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1194
 * 
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek             # <<<<<<<<<<<<<<
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fseek = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1195
 *         references, rlengths = self.get_references()
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read             # <<<<<<<<<<<<<<
 *         ftell = self.fhd.tell
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fread = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1196
 *         fseek = self.fhd.seek
 *         fread = self.fhd.read
 *         ftell = self.fhd.tell             # <<<<<<<<<<<<<<
 * 
 *         # for convenience, only count valid pairs
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ftell = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1199
 * 
 *         # for convenience, only count valid pairs
 *         add_loc = petrack.add_loc             # <<<<<<<<<<<<<<
 *         info = logging.info
 *         unpack = struct.unpack
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_add_loc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1200
 *         # for convenience, only count valid pairs
 *         add_loc = petrack.add_loc
 *         info = logging.info             # <<<<<<<<<<<<<<
 *         unpack = struct.unpack
 *         err = struct.error
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_info = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1201
 *         add_loc = petrack.add_loc
 *         info = logging.info
 *         unpack = struct.unpack             # <<<<<<<<<<<<<<
 *         err = struct.error
 *         while True:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_unpack = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1202
 *         info = logging.info
 *         unpack = struct.unpack
 *         err = struct.error             # <<<<<<<<<<<<<<
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_err = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1203
 *         unpack = struct.unpack
 *         err = struct.error
 *         while True:             # <<<<<<<<<<<<<<
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 */
  while (1) {
    if (!1) break;

    /* "MACS2/IO/cParser.pyx":1204
 *         err = struct.error
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]             # <<<<<<<<<<<<<<
 *             except err: break
 *             rawread = <bytes>fread(32)
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      /*try:*/ {
        __pyx_t_2 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_60));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_entrylength = __pyx_t_9;
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L14_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":1205
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break             # <<<<<<<<<<<<<<
 *             rawread = <bytes>fread(32)
 * #            rawread = <bytes>fread(entrylength)
 */
      __pyx_t_9 = PyErr_ExceptionMatches(__pyx_v_err);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.append_petrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L9_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        goto __pyx_L15_except_break;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L8_exception_handled;
        __pyx_L15_except_break:;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L12_try_break;
      }
      __pyx_L9_except_error:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L1_error;
      __pyx_L12_try_break:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      goto __pyx_L6_break;
      __pyx_L8_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_L14_try_end:;
    }

    /* "MACS2/IO/cParser.pyx":1206
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 *             rawread = <bytes>fread(32)             # <<<<<<<<<<<<<<
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 */
    __pyx_t_3 = PyObject_Call(__pyx_v_fread, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_rawread = __pyx_t_10;

    /* "MACS2/IO/cParser.pyx":1208
 *             rawread = <bytes>fread(32)
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)             # <<<<<<<<<<<<<<
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue
 */
    __pyx_v_read = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx___pe_binary_parse(__pyx_v_self, __pyx_v_rawread);

    /* "MACS2/IO/cParser.pyx":1209
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 *             fseek(entrylength - 32, 1)             # <<<<<<<<<<<<<<
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 */
    __pyx_t_3 = PyInt_FromLong((__pyx_v_entrylength - 32)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_v_fseek, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "MACS2/IO/cParser.pyx":1210
 *             read = self.__pe_binary_parse(rawread)
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue             # <<<<<<<<<<<<<<
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 *             i+=1
 */
    __pyx_t_11 = ((__pyx_v_read.ref == -1) != 0);
    if (__pyx_t_11) {
      goto __pyx_L5_continue;
      goto __pyx_L17;
    }
    __pyx_L17:;

    /* "MACS2/IO/cParser.pyx":1211
 *             fseek(entrylength - 32, 1)
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size             # <<<<<<<<<<<<<<
 *             i+=1
 *             if i == 1000000:
 */
    __pyx_t_12 = __Pyx_abs_int(__pyx_v_read.tlen); 
    __pyx_t_13 = ((__pyx_v_d * __pyx_v_i) + __pyx_t_12);
    __pyx_t_14 = (__pyx_v_i + 1);
    if (unlikely(__pyx_t_14 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_d = (__pyx_t_13 / __pyx_t_14);

    /* "MACS2/IO/cParser.pyx":1212
 *             if read.ref == -1: continue
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 *             i+=1             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":1213
 *             d = (d * i + abs(read.tlen)) / (i + 1) # keep track of avg fragment size
 *             i+=1
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 info(" %d" % (m*1000000))
 */
    __pyx_t_11 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":1214
 *             i+=1
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 info(" %d" % (m*1000000))
 *                 i=0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":1215
 *             if i == 1000000:
 *                 m += 1
 *                 info(" %d" % (m*1000000))             # <<<<<<<<<<<<<<
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 */
      __pyx_t_3 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_v_info, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "MACS2/IO/cParser.pyx":1216
 *                 m += 1
 *                 info(" %d" % (m*1000000))
 *                 i=0             # <<<<<<<<<<<<<<
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i
 */
      __pyx_v_i = 0;
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "MACS2/IO/cParser.pyx":1217
 *                 info(" %d" % (m*1000000))
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)             # <<<<<<<<<<<<<<
 *         self.n = m * 1000000 + i
 *         self.d = int(d)
 */
    if (unlikely(((PyObject *)__pyx_v_references) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_references), __pyx_v_read.ref, sizeof(int), PyInt_FromLong, 1, 1, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_read.start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyInt_FromLong((__pyx_v_read.start + __pyx_v_read.tlen)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_add_loc, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_L5_continue:;
  }
  __pyx_L6_break:;

  /* "MACS2/IO/cParser.pyx":1218
 *                 i=0
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i             # <<<<<<<<<<<<<<
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 */
  __pyx_v_self->n = ((__pyx_v_m * 1000000) + __pyx_v_i);

  /* "MACS2/IO/cParser.pyx":1219
 *             add_loc(references[read.ref], read.start, read.start + read.tlen)
 *         self.n = m * 1000000 + i
 *         self.d = int(d)             # <<<<<<<<<<<<<<
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()
 */
  __pyx_v_self->d = ((int)__pyx_v_d);

  /* "MACS2/IO/cParser.pyx":1220
 *         self.n = m * 1000000 + i
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"             # <<<<<<<<<<<<<<
 *         self.fhd.close()
 *         petrack.finalize()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!((__pyx_v_d >= 0.0) != 0))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_87));
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "MACS2/IO/cParser.pyx":1221
 *         self.d = int(d)
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "MACS2/IO/cParser.pyx":1222
 *         assert d >= 0, "Something went wrong (mean fragment size was negative)"
 *         self.fhd.close()
 *         petrack.finalize()             # <<<<<<<<<<<<<<
 *         petrack.set_rlengths( rlengths )
 *         return petrack
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __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 = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1223
 *         self.fhd.close()
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )             # <<<<<<<<<<<<<<
 *         return petrack
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_petrack, __pyx_n_s__set_rlengths); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_rlengths));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_rlengths));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rlengths));
  __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 = 1223; __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;

  /* "MACS2/IO/cParser.pyx":1224
 *         petrack.finalize()
 *         petrack.set_rlengths( rlengths )
 *         return petrack             # <<<<<<<<<<<<<<
 * 
 *     cdef _BAMPEParsed __pe_binary_parse (self, char *data):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_petrack);
  __pyx_r = __pyx_v_petrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.append_petrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_references);
  __Pyx_XDECREF(__pyx_v_rlengths);
  __Pyx_XDECREF(__pyx_v_fseek);
  __Pyx_XDECREF(__pyx_v_fread);
  __Pyx_XDECREF(__pyx_v_ftell);
  __Pyx_XDECREF(__pyx_v_add_loc);
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_unpack);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_3append_petrack(PyObject *__pyx_v_self, PyObject *__pyx_v_petrack); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11BAMPEParser_2append_petrack[] = "Build PETrackI from all lines, return a PETrackI object.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_3append_petrack(PyObject *__pyx_v_self, PyObject *__pyx_v_petrack) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append_petrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_2append_petrack(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self), ((PyObject *)__pyx_v_petrack));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1179
 *         return petrack
 * 
 *     cpdef append_petrack (self, petrack):             # <<<<<<<<<<<<<<
 *         """Build PETrackI from all lines, return a PETrackI object.
 *         """
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_2append_petrack(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_petrack) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_petrack", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self->__pyx_base.__pyx_vtab)->append_petrack(__pyx_v_self, __pyx_v_petrack, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.append_petrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1226
 *         return petrack
 * 
 *     cdef _BAMPEParsed __pe_binary_parse (self, char *data):             # <<<<<<<<<<<<<<
 *         cdef:
 *             int nextpos, pos
 */

static struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed __pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___pe_binary_parse(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, char *__pyx_v_data) {
  int __pyx_v_nextpos;
  int __pyx_v_pos;
  short __pyx_v_bwflag;
  struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed __pyx_v_ret;
  PyObject *__pyx_v_unpack = NULL;
  struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  short __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pe_binary_parse", 0);

  /* "MACS2/IO/cParser.pyx":1239
 * #            int tlen = asint[7]
 * 
 *         ret.ref = -1             # <<<<<<<<<<<<<<
 *         ret.start = -1
 *         ret.tlen = 0
 */
  __pyx_v_ret.ref = -1;

  /* "MACS2/IO/cParser.pyx":1240
 * 
 *         ret.ref = -1
 *         ret.start = -1             # <<<<<<<<<<<<<<
 *         ret.tlen = 0
 *         # we skip lot of the available information in data (i.e. tag name, quality etc etc)
 */
  __pyx_v_ret.start = -1;

  /* "MACS2/IO/cParser.pyx":1241
 *         ret.ref = -1
 *         ret.start = -1
 *         ret.tlen = 0             # <<<<<<<<<<<<<<
 *         # we skip lot of the available information in data (i.e. tag name, quality etc etc)
 *         if not data: return ret
 */
  __pyx_v_ret.tlen = 0;

  /* "MACS2/IO/cParser.pyx":1243
 *         ret.tlen = 0
 *         # we skip lot of the available information in data (i.e. tag name, quality etc etc)
 *         if not data: return ret             # <<<<<<<<<<<<<<
 * 
 *         unpack = struct.unpack
 */
  __pyx_t_1 = ((!(__pyx_v_data != 0)) != 0);
  if (__pyx_t_1) {
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":1245
 *         if not data: return ret
 * 
 *         unpack = struct.unpack             # <<<<<<<<<<<<<<
 *         bwflag = unpack('<hh', data[12:16])[1]
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__struct); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__unpack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_unpack = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1246
 * 
 *         unpack = struct.unpack
 *         bwflag = unpack('<hh', data[12:16])[1]             # <<<<<<<<<<<<<<
 * 
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 12, 16 - 12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_78));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_78));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_78));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsShort(__pyx_t_2); if (unlikely((__pyx_t_4 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_bwflag = __pyx_t_4;

  /* "MACS2/IO/cParser.pyx":1248
 *         bwflag = unpack('<hh', data[12:16])[1]
 * 
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:             # <<<<<<<<<<<<<<
 *             return ret       #unmapped sequence or bad sequence
 *         if bwflag & 1:
 */
  __pyx_t_1 = ((__pyx_v_bwflag & 4) != 0);
  if (!__pyx_t_1) {
    __pyx_t_5 = ((__pyx_v_bwflag & 512) != 0);
    if (!__pyx_t_5) {
      __pyx_t_6 = ((__pyx_v_bwflag & 1024) != 0);
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_5;
    }
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "MACS2/IO/cParser.pyx":1249
 * 
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ret       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
    __pyx_r = __pyx_v_ret;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":1250
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ret       #unmapped sequence or bad sequence
 *         if bwflag & 1:             # <<<<<<<<<<<<<<
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 */
  __pyx_t_5 = ((__pyx_v_bwflag & 1) != 0);
  if (__pyx_t_5) {

    /* "MACS2/IO/cParser.pyx":1253
 *             # paired read. We should only keep sequence if the mate is mapped
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:             # <<<<<<<<<<<<<<
 *                 return ret  # not a proper pair
 *             if bwflag & 8:
 */
    __pyx_t_5 = ((!((__pyx_v_bwflag & 2) != 0)) != 0);
    if (__pyx_t_5) {

      /* "MACS2/IO/cParser.pyx":1254
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return ret  # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return ret  # the mate is unmapped
 */
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "MACS2/IO/cParser.pyx":1255
 *             if not bwflag & 2:
 *                 return ret  # not a proper pair
 *             if bwflag & 8:             # <<<<<<<<<<<<<<
 *                 return ret  # the mate is unmapped
 *             if bwflag & 128:
 */
    __pyx_t_5 = ((__pyx_v_bwflag & 8) != 0);
    if (__pyx_t_5) {

      /* "MACS2/IO/cParser.pyx":1256
 *                 return ret  # not a proper pair
 *             if bwflag & 8:
 *                 return ret  # the mate is unmapped             # <<<<<<<<<<<<<<
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 */
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":1257
 *             if bwflag & 8:
 *                 return ret  # the mate is unmapped
 *             if bwflag & 128:             # <<<<<<<<<<<<<<
 *                 # this is not the first read in a pair
 *                 return ret
 */
    __pyx_t_5 = ((__pyx_v_bwflag & 128) != 0);
    if (__pyx_t_5) {

      /* "MACS2/IO/cParser.pyx":1259
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return ret             # <<<<<<<<<<<<<<
 * 
 *         ret.ref = unpack('<i', data[0:4])[0]
 */
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "MACS2/IO/cParser.pyx":1261
 *                 return ret
 * 
 *         ret.ref = unpack('<i', data[0:4])[0]             # <<<<<<<<<<<<<<
 *         pos = unpack('<i', data[4:8])[0]
 *         nextpos = unpack('<i', data[24:28])[0]
 */
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 0, 4 - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ret.ref = __pyx_t_8;

  /* "MACS2/IO/cParser.pyx":1262
 * 
 *         ret.ref = unpack('<i', data[0:4])[0]
 *         pos = unpack('<i', data[4:8])[0]             # <<<<<<<<<<<<<<
 *         nextpos = unpack('<i', data[24:28])[0]
 *         ret.start = min(pos, nextpos)
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 4, 8 - 4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_pos = __pyx_t_8;

  /* "MACS2/IO/cParser.pyx":1263
 *         ret.ref = unpack('<i', data[0:4])[0]
 *         pos = unpack('<i', data[4:8])[0]
 *         nextpos = unpack('<i', data[24:28])[0]             # <<<<<<<<<<<<<<
 *         ret.start = min(pos, nextpos)
 *         ret.tlen = abs(unpack('<i', data[28:32])[0])
 */
  __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 24, 28 - 24); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nextpos = __pyx_t_8;

  /* "MACS2/IO/cParser.pyx":1264
 *         pos = unpack('<i', data[4:8])[0]
 *         nextpos = unpack('<i', data[24:28])[0]
 *         ret.start = min(pos, nextpos)             # <<<<<<<<<<<<<<
 *         ret.tlen = abs(unpack('<i', data[28:32])[0])
 * 
 */
  __pyx_t_8 = __pyx_v_nextpos;
  __pyx_t_9 = __pyx_v_pos;
  if (((__pyx_t_8 < __pyx_t_9) != 0)) {
    __pyx_t_10 = __pyx_t_8;
  } else {
    __pyx_t_10 = __pyx_t_9;
  }
  __pyx_v_ret.start = __pyx_t_10;

  /* "MACS2/IO/cParser.pyx":1265
 *         nextpos = unpack('<i', data[24:28])[0]
 *         ret.start = min(pos, nextpos)
 *         ret.tlen = abs(unpack('<i', data[28:32])[0])             # <<<<<<<<<<<<<<
 * 
 *         # In case of paired-end we have now skipped all possible "bad" pairs
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_data + 28, 32 - 28); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_60));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_v_unpack, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Absolute(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ret.tlen = __pyx_t_10;

  /* "MACS2/IO/cParser.pyx":1272
 *         # start position... hope I'm right!
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * cdef struct _BAMPEParsed:
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("MACS2.IO.cParser.BAMPEParser.__pe_binary_parse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_unpack);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n___get__(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1042
 *     1024    PCR or optical duplicate
 *     """
 *     cdef public int n             # <<<<<<<<<<<<<<
 *     cdef public int d
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n___get__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.n.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n_2__set__(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1n_2__set__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->n = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.n.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d___get__(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1043
 *     """
 *     cdef public int n
 *     cdef public int d             # <<<<<<<<<<<<<<
 * 
 *     cpdef build_petrack ( self ):
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d___get__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.d.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d_2__set__(((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5MACS2_2IO_7cParser_11BAMPEParser_1d_2__set__(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->d = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.BAMPEParser.d.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_12BowtieParser___tlen_parse_line[] = "Parse tag sequence, then tag length.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_1__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_12BowtieParser___tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1286
 * 
 *     """
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Parse tag sequence, then tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_12BowtieParser___tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":1292
 *         cdef list thisfields
 * 
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1293
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_90));
    __pyx_r = ((PyObject *)__pyx_k_tuple_90);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":1294
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 *         return len( thisfields[ 4 ] )
 */
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_thisline), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_15), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_91));
    __pyx_r = ((PyObject *)__pyx_k_tuple_91);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":1295
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble             # <<<<<<<<<<<<<<
 *         return len( thisfields[ 4 ] )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_92), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1296
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 *         return len( thisfields[ 4 ] )             # <<<<<<<<<<<<<<
 * 
 *     def __fw_parse_line (self, str thisline ):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 4, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("MACS2.IO.cParser.BowtieParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_12BowtieParser_2__fw_parse_line[] = "\n        The following definition comes from bowtie website:\n        \n        The bowtie aligner outputs each alignment on a separate\n        line. Each line is a collection of 8 fields separated by tabs;\n        from left to right, the fields are:\n\n        1. Name of read that aligned\n\n        2. Orientation of read in the alignment, - for reverse\n        complement, + otherwise\n\n        3. Name of reference sequence where alignment occurs, or\n        ordinal ID if no name was provided\n\n        4. 0-based offset into the forward reference strand where\n        leftmost character of the alignment occurs\n\n        5. Read sequence (reverse-complemented if orientation is -)\n\n        6. ASCII-encoded read qualities (reversed if orientation is\n        -). The encoded quality values are on the Phred scale and the\n        encoding is ASCII-offset by 33 (ASCII char !).\n\n        7. Number of other instances where the same read aligns\n        against the same reference characters as were aligned against\n        in this alignment. This is not the number of other places the\n        read aligns with the same number of mismatches. The number in\n        this column is generally not a good proxy for that number\n        (e.g., the number in this column may be '0' while the number\n        of other alignments with the same number of mismatches might\n        be large). This column was previously described as 'Reserved'.\n\n        8. Comma-separated list of mismatch descriptors. If there are\n        no mismatches in the alignment, this field is empty. A single\n        descriptor has the format offset:reference-base>read-base. The\n        offset is expressed as a 0-based offset from the high-quality\n        (5') end of the read.\n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_3__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_12BowtieParser_2__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1298
 *         return len( thisfields[ 4 ] )
 * 
 *     def __fw_parse_line (self, str thisline ):             # <<<<<<<<<<<<<<
 *         """
 *         The following definition comes from bowtie website:
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_12BowtieParser_2__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser *__pyx_v_self, PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_thisfields = 0;
  PyObject *__pyx_v_chromname = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  char *__pyx_t_13;
  char *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);
  __Pyx_INCREF(__pyx_v_thisline);

  /* "MACS2/IO/cParser.pyx":1343
 *             str chromname
 * 
 *         thisline = thisline.rstrip()             # <<<<<<<<<<<<<<
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_thisline));
  __pyx_v_thisline = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1344
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_thisline)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_93));
    __pyx_r = ((PyObject *)__pyx_k_tuple_93);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":1345
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 * 
 */
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_thisline), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_15), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_94));
    __pyx_r = ((PyObject *)__pyx_k_tuple_94);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "MACS2/IO/cParser.pyx":1346
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble             # <<<<<<<<<<<<<<
 * 
 *         chromname = thisfields[ 2 ]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_thisline), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_thisfields = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1348
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 * 
 *         chromname = thisfields[ 2 ]             # <<<<<<<<<<<<<<
 *         try:
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 */
  if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 2, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  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 = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_chromname = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1349
 * 
 *         chromname = thisfields[ 2 ]
 *         try:             # <<<<<<<<<<<<<<
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *         except ValueError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":1350
 *         chromname = thisfields[ 2 ]
 *         try:
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
      if (unlikely(((PyObject *)__pyx_v_chromname) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_chromname), __pyx_n_s__rindex); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_96), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_chromname), 0, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_v_chromname));
      __pyx_v_chromname = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":1351
 *         try:
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             pass
 * 
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("MACS2.IO.cParser.BowtieParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_10);

      /* "MACS2/IO/cParser.pyx":1354
 *             pass
 * 
 *             if thisfields[ 1 ] == "+":             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 3 ] ),
 */
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      }
      __pyx_t_11 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_20), Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_4) {

        /* "MACS2/IO/cParser.pyx":1355
 * 
 *             if thisfields[ 1 ] == "+":
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 3 ] ),
 *                          0 )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "MACS2/IO/cParser.pyx":1356
 *             if thisfields[ 1 ] == "+":
 *                 return ( chromname,
 *                          atoi( thisfields[ 3 ] ),             # <<<<<<<<<<<<<<
 *                          0 )
 *             elif thisfields[ 1 ] == "-":
 */
        if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        }
        __pyx_t_12 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 3, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_AsString(__pyx_t_12); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyInt_FromLong(atoi(__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(((PyObject *)__pyx_v_chromname));
        PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_chromname));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_chromname));
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_12 = 0;
        __pyx_r = ((PyObject *)__pyx_t_11);
        __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L8_except_return;
        goto __pyx_L15;
      }

      /* "MACS2/IO/cParser.pyx":1358
 *                          atoi( thisfields[ 3 ] ),
 *                          0 )
 *             elif thisfields[ 1 ] == "-":             # <<<<<<<<<<<<<<
 *                 return ( chromname,
 *                          atoi( thisfields[ 3 ] ) + strlen( thisfields[ 4 ] ),
 */
      if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      }
      __pyx_t_11 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_11, ((PyObject *)__pyx_kp_s_21), Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_4) {

        /* "MACS2/IO/cParser.pyx":1359
 *                          0 )
 *             elif thisfields[ 1 ] == "-":
 *                 return ( chromname,             # <<<<<<<<<<<<<<
 *                          atoi( thisfields[ 3 ] ) + strlen( thisfields[ 4 ] ),
 *                          1 )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "MACS2/IO/cParser.pyx":1360
 *             elif thisfields[ 1 ] == "-":
 *                 return ( chromname,
 *                          atoi( thisfields[ 3 ] ) + strlen( thisfields[ 4 ] ),             # <<<<<<<<<<<<<<
 *                          1 )
 *             else:
 */
        if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        }
        __pyx_t_12 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 3, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_AsString(__pyx_t_12); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        }
        __pyx_t_12 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 4, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_t_12); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyInt_FromSize_t((atoi(__pyx_t_13) + strlen(__pyx_t_14))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(((PyObject *)__pyx_v_chromname));
        PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_chromname));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_chromname));
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        __pyx_t_12 = 0;
        __pyx_r = ((PyObject *)__pyx_t_11);
        __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L8_except_return;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":1363
 *                          1 )
 *             else:
 *                 raise StrandFormatError( thisline, thisfields[ 1 ] )             # <<<<<<<<<<<<<<
 * 
 * cdef class PySAMParser:
 */
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__StrandFormatError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        if (unlikely(((PyObject *)__pyx_v_thisfields) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        }
        __pyx_t_12 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_thisfields), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_INCREF(((PyObject *)__pyx_v_thisline));
        PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_thisline));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_thisline));
        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
        __Pyx_Raise(__pyx_t_12, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      }
      __pyx_L15:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    goto __pyx_L0;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
    __pyx_L12_try_end:;
  }

  __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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("MACS2.IO.cParser.BowtieParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisfields);
  __Pyx_XDECREF(__pyx_v_chromname);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser___init__[] = "Open input file. Determine whether it's a gzipped file.\n\n        'filename' must be a string object.\n\n        This function initialize the following attributes:\n\n        1. self.filename: the filename for input file.\n        2. self.gzipped: a boolean indicating whether input file is gzipped.\n        3. self.fhd: buffered I/O stream of input file\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_5MACS2_2IO_7cParser_11PySAMParser___init__;
#endif
static int __pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_filename = ((PyObject*)values[0]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 1, "filename", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser___init__(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self), __pyx_v_filename);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1374
 *     cdef object fhd
 * 
 *     def __init__ ( self, str filename ):             # <<<<<<<<<<<<<<
 *         """Open input file. Determine whether it's a gzipped file.
 * 
 */

static int __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser___init__(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, PyObject *__pyx_v_filename) {
  PyObject *__pyx_v_f = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "MACS2/IO/cParser.pyx":1385
 *         3. self.fhd: buffered I/O stream of input file
 *         """
 *         self.filename = filename             # <<<<<<<<<<<<<<
 *         self.gzipped = True
 *         self.tag_size = -1
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_filename));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
  __Pyx_GOTREF(__pyx_v_self->filename);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->filename));
  __pyx_v_self->filename = __pyx_v_filename;

  /* "MACS2/IO/cParser.pyx":1386
 *         """
 *         self.filename = filename
 *         self.gzipped = True             # <<<<<<<<<<<<<<
 *         self.tag_size = -1
 *         # try gzip first
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->gzipped);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->gzipped));
  __pyx_v_self->gzipped = ((PyBoolObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1387
 *         self.filename = filename
 *         self.gzipped = True
 *         self.tag_size = -1             # <<<<<<<<<<<<<<
 *         # try gzip first
 *         f = gzip.open( filename )
 */
  __pyx_v_self->tag_size = -1;

  /* "MACS2/IO/cParser.pyx":1389
 *         self.tag_size = -1
 *         # try gzip first
 *         f = gzip.open( filename )             # <<<<<<<<<<<<<<
 *         try:
 *             f.read( 10 )
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__open); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_filename));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_filename));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_f = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1390
 *         # try gzip first
 *         f = gzip.open( filename )
 *         try:             # <<<<<<<<<<<<<<
 *             f.read( 10 )
 *         except IOError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":1391
 *         f = gzip.open( filename )
 *         try:
 *             f.read( 10 )             # <<<<<<<<<<<<<<
 *         except IOError:
 *             # not a gzipped file
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__read); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":1392
 *         try:
 *             f.read( 10 )
 *         except IOError:             # <<<<<<<<<<<<<<
 *             # not a gzipped file
 *             self.gzipped = False
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_IOError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "MACS2/IO/cParser.pyx":1394
 *         except IOError:
 *             # not a gzipped file
 *             self.gzipped = False             # <<<<<<<<<<<<<<
 *         f.close()
 *         if self.gzipped:
 */
      __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_v_self->gzipped);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->gzipped));
      __pyx_v_self->gzipped = ((PyBoolObject *)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L10_try_end:;
  }

  /* "MACS2/IO/cParser.pyx":1395
 *             # not a gzipped file
 *             self.gzipped = False
 *         f.close()             # <<<<<<<<<<<<<<
 *         if self.gzipped:
 *             # open with gzip.open, then wrap it with BufferedReader!
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "MACS2/IO/cParser.pyx":1396
 *             self.gzipped = False
 *         f.close()
 *         if self.gzipped:             # <<<<<<<<<<<<<<
 *             # open with gzip.open, then wrap it with BufferedReader!
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->gzipped)); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_9) {

    /* "MACS2/IO/cParser.pyx":1398
 *         if self.gzipped:
 *             # open with gzip.open, then wrap it with BufferedReader!
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )             # <<<<<<<<<<<<<<
 *         else:
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__BufferedReader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gzip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__open); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_10);
    __Pyx_GOTREF(__pyx_v_self->fhd);
    __Pyx_DECREF(__pyx_v_self->fhd);
    __pyx_v_self->fhd = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "MACS2/IO/cParser.pyx":1400
 *             self.fhd = io.BufferedReader( gzip.open( filename, mode='rb' ) )
 *         else:
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!             # <<<<<<<<<<<<<<
 * 
 *     def tsize( self ):
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__io); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__open); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)__pyx_v_filename));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_filename));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_filename));
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__rb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_10), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->fhd);
    __Pyx_DECREF(__pyx_v_self->fhd);
    __pyx_v_self->fhd = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L13:;

  __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_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_3tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_2tsize[] = "General function to detect tag size.\n\n        * Although it can be used by most parsers, it must be\n          rewritten by BAMParser!\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_3tsize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tsize (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_2tsize(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1402
 *             self.fhd = io.open( filename, mode='rb' ) # binary mode! I don't expect unicode here!
 * 
 *     def tsize( self ):             # <<<<<<<<<<<<<<
 *         """General function to detect tag size.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_2tsize(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self) {
  int __pyx_v_s;
  int __pyx_v_n;
  int __pyx_v_m;
  int __pyx_v_this_taglength;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("tsize", 0);

  /* "MACS2/IO/cParser.pyx":1409
 *         """
 *         cdef:
 *             int s = 0             # <<<<<<<<<<<<<<
 *             int n = 0     # number of successful/valid read alignments
 *             int m = 0     # number of trials
 */
  __pyx_v_s = 0;

  /* "MACS2/IO/cParser.pyx":1410
 *         cdef:
 *             int s = 0
 *             int n = 0     # number of successful/valid read alignments             # <<<<<<<<<<<<<<
 *             int m = 0     # number of trials
 *             int this_taglength
 */
  __pyx_v_n = 0;

  /* "MACS2/IO/cParser.pyx":1411
 *             int s = 0
 *             int n = 0     # number of successful/valid read alignments
 *             int m = 0     # number of trials             # <<<<<<<<<<<<<<
 *             int this_taglength
 * 
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":1414
 *             int this_taglength
 * 
 *         if self.tag_size != -1:             # <<<<<<<<<<<<<<
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size
 */
  __pyx_t_1 = ((__pyx_v_self->tag_size != -1) != 0);
  if (__pyx_t_1) {

    /* "MACS2/IO/cParser.pyx":1416
 *         if self.tag_size != -1:
 *             # if we have already calculated tag size (!= -1),  return it.
 *             return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *         # try 10k times or retrieve 10 successfule alignments
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tag_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "MACS2/IO/cParser.pyx":1419
 * 
 *         # try 10k times or retrieve 10 successfule alignments
 *         while n < 10 and m < 10000:             # <<<<<<<<<<<<<<
 *             m += 1
 *             thisline = self.fhd.readline()
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_n < 10) != 0);
    if (__pyx_t_1) {
      __pyx_t_3 = ((__pyx_v_m < 10000) != 0);
      __pyx_t_4 = __pyx_t_3;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (!__pyx_t_4) break;

    /* "MACS2/IO/cParser.pyx":1420
 *         # try 10k times or retrieve 10 successfule alignments
 *         while n < 10 and m < 10000:
 *             m += 1             # <<<<<<<<<<<<<<
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )
 */
    __pyx_v_m = (__pyx_v_m + 1);

    /* "MACS2/IO/cParser.pyx":1421
 *         while n < 10 and m < 10000:
 *             m += 1
 *             thisline = self.fhd.readline()             # <<<<<<<<<<<<<<
 *             this_taglength = self.__tlen_parse_line( thisline )
 *             if this_taglength > 0:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__readline); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "MACS2/IO/cParser.pyx":1422
 *             m += 1
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             if this_taglength > 0:
 *                 # this_taglength == 0 means this line doesn't contain
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____tlen_parse_line); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_this_taglength = __pyx_t_7;

    /* "MACS2/IO/cParser.pyx":1423
 *             thisline = self.fhd.readline()
 *             this_taglength = self.__tlen_parse_line( thisline )
 *             if this_taglength > 0:             # <<<<<<<<<<<<<<
 *                 # this_taglength == 0 means this line doesn't contain
 *                 # successful alignment.
 */
    __pyx_t_4 = ((__pyx_v_this_taglength > 0) != 0);
    if (__pyx_t_4) {

      /* "MACS2/IO/cParser.pyx":1426
 *                 # this_taglength == 0 means this line doesn't contain
 *                 # successful alignment.
 *                 s += this_taglength             # <<<<<<<<<<<<<<
 *                 n += 1
 *         # done
 */
      __pyx_v_s = (__pyx_v_s + __pyx_v_this_taglength);

      /* "MACS2/IO/cParser.pyx":1427
 *                 # successful alignment.
 *                 s += this_taglength
 *                 n += 1             # <<<<<<<<<<<<<<
 *         # done
 *         self.fhd.seek( 0 )
 */
      __pyx_v_n = (__pyx_v_n + 1);
      goto __pyx_L6;
    }
    __pyx_L6:;
  }

  /* "MACS2/IO/cParser.pyx":1429
 *                 n += 1
 *         # done
 *         self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = s/n
 *         return self.tag_size
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1430
 *         # done
 *         self.fhd.seek( 0 )
 *         self.tag_size = s/n             # <<<<<<<<<<<<<<
 *         return self.tag_size
 * 
 */
  if (unlikely(__pyx_v_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_n == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_s))) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_Format(PyExc_OverflowError, "value too large to perform division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_self->tag_size = __Pyx_div_int(__pyx_v_s, __pyx_v_n);

  /* "MACS2/IO/cParser.pyx":1431
 *         self.fhd.seek( 0 )
 *         self.tag_size = s/n
 *         return self.tag_size             # <<<<<<<<<<<<<<
 * 
 *     def __tlen_parse_line ( self, str thisline ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->tag_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.tsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_5__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_4__tlen_parse_line[] = "Abstract function to detect tag length.\n        \n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_5__tlen_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__tlen_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_4__tlen_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1433
 *         return self.tag_size
 * 
 *     def __tlen_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Abstract function to detect tag length.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_4__tlen_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__tlen_parse_line", 0);

  /* "MACS2/IO/cParser.pyx":1437
 * 
 *         """
 *         raise NotImplemented             # <<<<<<<<<<<<<<
 * 
 *     def build_fwtrack ( self ):
 */
  __Pyx_Raise(__pyx_builtin_NotImplemented, 0, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.__tlen_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_7build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_6build_fwtrack[] = "Generic function to build FWTrackIII object. Create a new\n        FWTrackIII object. If you want to append new records to an\n        existing FWTrackIII object, try append_fwtrack function.\n\n        * BAMParser for binary BAM format should have a different one.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_7build_fwtrack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("build_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_6build_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1439
 *         raise NotImplemented
 * 
 *     def build_fwtrack ( self ):             # <<<<<<<<<<<<<<
 *         """Generic function to build FWTrackIII object. Create a new
 *         FWTrackIII object. If you want to append new records to an
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_6build_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self) {
  long __pyx_v_i;
  long __pyx_v_m;
  long __pyx_v_fpos;
  long __pyx_v_strand;
  PyObject *__pyx_v_chromosome = 0;
  PyObject *__pyx_v_fwtrack = NULL;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  long __pyx_t_10;
  long __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_fwtrack", 0);

  /* "MACS2/IO/cParser.pyx":1450
 *             str chromosome
 * 
 *         fwtrack = FWTrackIII()             # <<<<<<<<<<<<<<
 *         i = 0
 *         m = 0
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__FWTrackIII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fwtrack = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1451
 * 
 *         fwtrack = FWTrackIII()
 *         i = 0             # <<<<<<<<<<<<<<
 *         m = 0
 *         for thisline in self.fhd:
 */
  __pyx_v_i = 0;

  /* "MACS2/IO/cParser.pyx":1452
 *         fwtrack = FWTrackIII()
 *         i = 0
 *         m = 0             # <<<<<<<<<<<<<<
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 */
  __pyx_v_m = 0;

  /* "MACS2/IO/cParser.pyx":1453
 *         i = 0
 *         m = 0
 *         for thisline in self.fhd:             # <<<<<<<<<<<<<<
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 */
  if (PyList_CheckExact(__pyx_v_self->fhd) || PyTuple_CheckExact(__pyx_v_self->fhd)) {
    __pyx_t_2 = __pyx_v_self->fhd; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->fhd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":1454
 *         m = 0
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if fpos < 0 or not chromosome:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____fw_parse_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_1 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(PyString_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyInt_AsLong(__pyx_t_7); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_chromosome));
    __pyx_v_chromosome = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_fpos = __pyx_t_10;
    __pyx_v_strand = __pyx_t_11;

    /* "MACS2/IO/cParser.pyx":1455
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if fpos < 0 or not chromosome:
 *                 # normally __fw_parse_line will return -1 if the line
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "MACS2/IO/cParser.pyx":1456
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 *             if fpos < 0 or not chromosome:             # <<<<<<<<<<<<<<
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 */
    __pyx_t_12 = ((__pyx_v_fpos < 0) != 0);
    if (!__pyx_t_12) {
      __pyx_t_13 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_chromosome)); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_14 = ((!__pyx_t_13) != 0);
      __pyx_t_13 = __pyx_t_14;
    } else {
      __pyx_t_13 = __pyx_t_12;
    }
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":1459
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 *                 continue             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":1460
 *                 # contains no successful alignment.
 *                 continue
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_13 = ((__pyx_v_i == 1000000) != 0);
    if (__pyx_t_13) {

      /* "MACS2/IO/cParser.pyx":1461
 *                 continue
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 */
      __pyx_v_m = (__pyx_v_m + 1);

      /* "MACS2/IO/cParser.pyx":1462
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromLong((__pyx_v_m * 1000000)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":1463
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0             # <<<<<<<<<<<<<<
 *             fwtrack.add_loc( chromosome, fpos, strand )
 * 
 */
      __pyx_v_i = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":1464
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *         # close fwtrack and sort
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_v_chromosome));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_chromosome));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chromosome));
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1467
 * 
 *         # close fwtrack and sort
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         # close file stream.
 *         self.close()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "MACS2/IO/cParser.pyx":1469
 *         fwtrack.finalize()
 *         # close file stream.
 *         self.close()             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":1470
 *         # close file stream.
 *         self.close()
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 *     def append_fwtrack ( self, fwtrack ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.build_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XDECREF(__pyx_v_fwtrack);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_9append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_8append_fwtrack[] = "Add more records to an existing FWTrackIII object. \n\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_9append_fwtrack(PyObject *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("append_fwtrack (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_8append_fwtrack(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self), ((PyObject *)__pyx_v_fwtrack));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1472
 *         return fwtrack
 * 
 *     def append_fwtrack ( self, fwtrack ):             # <<<<<<<<<<<<<<
 *         """Add more records to an existing FWTrackIII object.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_8append_fwtrack(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, PyObject *__pyx_v_fwtrack) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_thisline = NULL;
  PyObject *__pyx_v_chromosome = NULL;
  PyObject *__pyx_v_fpos = NULL;
  PyObject *__pyx_v_strand = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("append_fwtrack", 0);

  /* "MACS2/IO/cParser.pyx":1476
 * 
 *         """
 *         i = 0             # <<<<<<<<<<<<<<
 *         m = 0
 *         for thisline in self.fhd:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_i = __pyx_int_0;

  /* "MACS2/IO/cParser.pyx":1477
 *         """
 *         i = 0
 *         m = 0             # <<<<<<<<<<<<<<
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_m = __pyx_int_0;

  /* "MACS2/IO/cParser.pyx":1478
 *         i = 0
 *         m = 0
 *         for thisline in self.fhd:             # <<<<<<<<<<<<<<
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 */
  if (PyList_CheckExact(__pyx_v_self->fhd) || PyTuple_CheckExact(__pyx_v_self->fhd)) {
    __pyx_t_1 = __pyx_v_self->fhd; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->fhd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF(__pyx_v_thisline);
    __pyx_v_thisline = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "MACS2/IO/cParser.pyx":1479
 *         m = 0
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )             # <<<<<<<<<<<<<<
 *             i+=1
 *             if fpos < 0 or not chromosome:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____fw_parse_line); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_thisline);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_thisline);
    __Pyx_GIVEREF(__pyx_v_thisline);
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_chromosome);
    __pyx_v_chromosome = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_fpos);
    __pyx_v_fpos = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_strand);
    __pyx_v_strand = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "MACS2/IO/cParser.pyx":1480
 *         for thisline in self.fhd:
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1             # <<<<<<<<<<<<<<
 *             if fpos < 0 or not chromosome:
 *                 # normally __fw_parse_line will return -1 if the line
 */
    __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "MACS2/IO/cParser.pyx":1481
 *             ( chromosome, fpos, strand ) = self.__fw_parse_line( thisline )
 *             i+=1
 *             if fpos < 0 or not chromosome:             # <<<<<<<<<<<<<<
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_fpos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!__pyx_t_10) {
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_chromosome); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = (!__pyx_t_11);
      __pyx_t_11 = __pyx_t_12;
    } else {
      __pyx_t_11 = __pyx_t_10;
    }
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":1484
 *                 # normally __fw_parse_line will return -1 if the line
 *                 # contains no successful alignment.
 *                 continue             # <<<<<<<<<<<<<<
 *             if i == 1000000:
 *                 m += 1
 */
      goto __pyx_L3_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "MACS2/IO/cParser.pyx":1485
 *                 # contains no successful alignment.
 *                 continue
 *             if i == 1000000:             # <<<<<<<<<<<<<<
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 */
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_i, __pyx_int_1000000, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_11) {

      /* "MACS2/IO/cParser.pyx":1486
 *                 continue
 *             if i == 1000000:
 *                 m += 1             # <<<<<<<<<<<<<<
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 */
      __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_m, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_v_m);
      __pyx_v_m = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "MACS2/IO/cParser.pyx":1487
 *             if i == 1000000:
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )             # <<<<<<<<<<<<<<
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Multiply(__pyx_v_m, __pyx_int_1000000); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "MACS2/IO/cParser.pyx":1488
 *                 m += 1
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0             # <<<<<<<<<<<<<<
 *             fwtrack.add_loc( chromosome, fpos, strand )
 * 
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF(__pyx_v_i);
      __pyx_v_i = __pyx_int_0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "MACS2/IO/cParser.pyx":1489
 *                 logging.info( " %d" % ( m*1000000 ) )
 *                 i=0
 *             fwtrack.add_loc( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *         # close fwtrack and sort
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__add_loc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_chromosome);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chromosome);
    __Pyx_GIVEREF(__pyx_v_chromosome);
    __Pyx_INCREF(__pyx_v_fpos);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_fpos);
    __Pyx_GIVEREF(__pyx_v_fpos);
    __Pyx_INCREF(__pyx_v_strand);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_strand);
    __Pyx_GIVEREF(__pyx_v_strand);
    __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1492
 * 
 *         # close fwtrack and sort
 *         fwtrack.finalize()             # <<<<<<<<<<<<<<
 *         self.close()
 *         return fwtrack
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fwtrack, __pyx_n_s__finalize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "MACS2/IO/cParser.pyx":1493
 *         # close fwtrack and sort
 *         fwtrack.finalize()
 *         self.close()             # <<<<<<<<<<<<<<
 *         return fwtrack
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__close); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":1494
 *         fwtrack.finalize()
 *         self.close()
 *         return fwtrack             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_fwtrack);
  __pyx_r = __pyx_v_fwtrack;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.append_fwtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_thisline);
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XDECREF(__pyx_v_fpos);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_11__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_10__fw_parse_line[] = "Abstract function to parse chromosome, 5' end position and\n        strand.\n        \n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_11__fw_parse_line(PyObject *__pyx_v_self, PyObject *__pyx_v_thisline) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__fw_parse_line (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thisline), (&PyString_Type), 1, "thisline", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_10__fw_parse_line(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self), ((PyObject*)__pyx_v_thisline));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1498
 * 
 * 
 *     def __fw_parse_line ( self, str thisline ):             # <<<<<<<<<<<<<<
 *         """Abstract function to parse chromosome, 5' end position and
 *         strand.
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_10__fw_parse_line(CYTHON_UNUSED struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_thisline) {
  PyObject *__pyx_v_chromosome = 0;
  int __pyx_v_fpos;
  int __pyx_v_strand;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__fw_parse_line", 0);

  /* "MACS2/IO/cParser.pyx":1503
 * 
 *         """
 *         cdef str chromosome = ""             # <<<<<<<<<<<<<<
 *         cdef int fpos = -1
 *         cdef int strand = -1
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  __pyx_v_chromosome = __pyx_kp_s_11;

  /* "MACS2/IO/cParser.pyx":1504
 *         """
 *         cdef str chromosome = ""
 *         cdef int fpos = -1             # <<<<<<<<<<<<<<
 *         cdef int strand = -1
 *         return ( chromosome, fpos, strand )
 */
  __pyx_v_fpos = -1;

  /* "MACS2/IO/cParser.pyx":1505
 *         cdef str chromosome = ""
 *         cdef int fpos = -1
 *         cdef int strand = -1             # <<<<<<<<<<<<<<
 *         return ( chromosome, fpos, strand )
 * 
 */
  __pyx_v_strand = -1;

  /* "MACS2/IO/cParser.pyx":1506
 *         cdef int fpos = -1
 *         cdef int strand = -1
 *         return ( chromosome, fpos, strand )             # <<<<<<<<<<<<<<
 * 
 *     def sniff ( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_fpos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __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 = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_chromosome));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chromosome));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chromosome));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.__fw_parse_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chromosome);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_13sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_12sniff[] = "Detect whether this parser is the correct parser for input\n        file.\n\n        Rule: try to find the tag size using this parser, if error\n        occurs or tag size is too small or too big, check is failed.\n\n        * BAMParser has a different sniff function.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_13sniff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sniff (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_12sniff(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1508
 *         return ( chromosome, fpos, strand )
 * 
 *     def sniff ( self ):             # <<<<<<<<<<<<<<
 *         """Detect whether this parser is the correct parser for input
 *         file.
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_12sniff(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self) {
  int __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sniff", 0);

  /* "MACS2/IO/cParser.pyx":1519
 *         cdef int t
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             t = self.tsize()
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":1520
 * 
 *         try:
 *             t = self.tsize()             # <<<<<<<<<<<<<<
 *         except:
 *             self.fhd.seek( 0 )
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__tsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_t = __pyx_t_6;
    }
    /*else:*/ {

      /* "MACS2/IO/cParser.pyx":1525
 *             return False
 *         else:
 *             if t <= 10 or t >= 10000:             # <<<<<<<<<<<<<<
 *                 self.fhd.seek( 0 )
 *                 return False
 */
      __pyx_t_7 = ((__pyx_v_t <= 10) != 0);
      if (!__pyx_t_7) {
        __pyx_t_8 = ((__pyx_v_t >= 10000) != 0);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_7;
      }
      if (__pyx_t_9) {

        /* "MACS2/IO/cParser.pyx":1526
 *         else:
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "MACS2/IO/cParser.pyx":1527
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 self.fhd.seek( 0 )
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L6_except_return;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "MACS2/IO/cParser.pyx":1529
 *                 return False
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "MACS2/IO/cParser.pyx":1530
 *             else:
 *                 self.fhd.seek( 0 )
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *     def close ( self ):
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L6_except_return;
      }
      __pyx_L11:;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "MACS2/IO/cParser.pyx":1521
 *         try:
 *             t = self.tsize()
 *         except:             # <<<<<<<<<<<<<<
 *             self.fhd.seek( 0 )
 *             return False
 */
    /*except:*/ {
      __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_10);

      /* "MACS2/IO/cParser.pyx":1522
 *             t = self.tsize()
 *         except:
 *             self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__seek); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "MACS2/IO/cParser.pyx":1523
 *         except:
 *             self.fhd.seek( 0 )
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             if t <= 10 or t >= 10000:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_12 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_r = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("MACS2.IO.cParser.PySAMParser.sniff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_14close[] = "Run this when this Parser will be never used.\n\n        Close file I/O stream.\n        ";
static PyObject *__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_14close(((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "MACS2/IO/cParser.pyx":1532
 *                 return True
 * 
 *     def close ( self ):             # <<<<<<<<<<<<<<
 *         """Run this when this Parser will be never used.
 * 
 */

static PyObject *__pyx_pf_5MACS2_2IO_7cParser_11PySAMParser_14close(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "MACS2/IO/cParser.pyx":1537
 *         Close file I/O stream.
 *         """
 *         self.fhd.close()             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->fhd, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __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_2); __pyx_t_2 = 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_AddTraceback("MACS2.IO.cParser.PySAMParser.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5MACS2_2IO_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5MACS2_2IO_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5MACS2_2IO_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":194
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5MACS2_2IO_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":200
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":203
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":204
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":206
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "numpy.pxd":208
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":209
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "numpy.pxd":211
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "numpy.pxd":213
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":214
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":217
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_3) {

    /* "numpy.pxd":218
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "numpy.pxd":221
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "numpy.pxd":222
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "numpy.pxd":223
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_2 = (__pyx_v_copy_shape != 0);
  if (__pyx_t_2) {

    /* "numpy.pxd":226
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "numpy.pxd":227
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "numpy.pxd":228
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":229
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "numpy.pxd":230
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "numpy.pxd":232
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "numpy.pxd":233
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L7:;

  /* "numpy.pxd":234
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "numpy.pxd":235
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "numpy.pxd":236
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "numpy.pxd":239
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":240
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "numpy.pxd":244
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":246
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_2) {
    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":248
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "numpy.pxd":251
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L10:;

  /* "numpy.pxd":253
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":254
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_5 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_5;

    /* "numpy.pxd":255
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (__pyx_t_1) {
      __pyx_t_2 = (__pyx_v_little_endian != 0);
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":256
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
      if (__pyx_t_1) {
        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "numpy.pxd":274
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    switch (__pyx_v_t) {

      /* "numpy.pxd":258
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
      case NPY_BYTE:
      __pyx_v_f = __pyx_k__b;
      break;

      /* "numpy.pxd":259
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = __pyx_k__B;
      break;

      /* "numpy.pxd":260
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = __pyx_k__h;
      break;

      /* "numpy.pxd":261
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = __pyx_k__H;
      break;

      /* "numpy.pxd":262
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = __pyx_k__i;
      break;

      /* "numpy.pxd":263
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = __pyx_k__I;
      break;

      /* "numpy.pxd":264
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = __pyx_k__l;
      break;

      /* "numpy.pxd":265
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = __pyx_k__L;
      break;

      /* "numpy.pxd":266
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = __pyx_k__q;
      break;

      /* "numpy.pxd":267
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = __pyx_k__Q;
      break;

      /* "numpy.pxd":268
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = __pyx_k__f;
      break;

      /* "numpy.pxd":269
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = __pyx_k__d;
      break;

      /* "numpy.pxd":270
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = __pyx_k__g;
      break;

      /* "numpy.pxd":271
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = __pyx_k__Zf;
      break;

      /* "numpy.pxd":272
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = __pyx_k__Zd;
      break;

      /* "numpy.pxd":273
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = __pyx_k__Zg;
      break;

      /* "numpy.pxd":274
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = __pyx_k__O;
      break;
      default:

      /* "numpy.pxd":276
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_108), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }

    /* "numpy.pxd":277
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":278
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "numpy.pxd":280
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":281
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":282
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "numpy.pxd":285
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = c'\0' # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_5MACS2_2IO_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":286
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }
  __pyx_L11:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("MACS2.IO.numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5MACS2_2IO_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5MACS2_2IO_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5MACS2_2IO_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":288
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5MACS2_2IO_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "numpy.pxd":289
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":290
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":291
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":292
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":770
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "numpy.pxd":771
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":773
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "numpy.pxd":774
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":776
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "numpy.pxd":777
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":779
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "numpy.pxd":780
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":782
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "numpy.pxd":783
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("MACS2.IO.numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":785
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5MACS2_2IO_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  char *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "numpy.pxd":792
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":793
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":796
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":797
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "numpy.pxd":798
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5MACS2_2IO_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "numpy.pxd":800
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "numpy.pxd":801
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "numpy.pxd":803
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (__pyx_t_7) {
      __pyx_t_8 = (__pyx_v_little_endian != 0);
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    if (!__pyx_t_8) {

      /* "numpy.pxd":804
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
      if (__pyx_t_7) {
        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
        __pyx_t_10 = __pyx_t_9;
      } else {
        __pyx_t_10 = __pyx_t_7;
      }
      __pyx_t_7 = __pyx_t_10;
    } else {
      __pyx_t_7 = __pyx_t_8;
    }
    if (__pyx_t_7) {

      /* "numpy.pxd":805
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "numpy.pxd":815
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_7) break;

      /* "numpy.pxd":816
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":817
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":818
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_11 = 0;
      (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1);
    }

    /* "numpy.pxd":820
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_11 = 0;
    (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize);

    /* "numpy.pxd":822
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_7) {

      /* "numpy.pxd":823
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":824
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (__pyx_t_7) {

        /* "numpy.pxd":825
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "numpy.pxd":828
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L13;
      }

      /* "numpy.pxd":829
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L13;
      }

      /* "numpy.pxd":830
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L13;
      }

      /* "numpy.pxd":831
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L13;
      }

      /* "numpy.pxd":832
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L13;
      }

      /* "numpy.pxd":833
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L13;
      }

      /* "numpy.pxd":834
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L13;
      }

      /* "numpy.pxd":835
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L13;
      }

      /* "numpy.pxd":836
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L13;
      }

      /* "numpy.pxd":837
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L13;
      }

      /* "numpy.pxd":838
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L13;
      }

      /* "numpy.pxd":839
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L13;
      }

      /* "numpy.pxd":840
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L13;
      }

      /* "numpy.pxd":841
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":842
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":843
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":844
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "numpy.pxd":846
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_108), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L13:;

      /* "numpy.pxd":847
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L11;
    }
    /*else*/ {

      /* "numpy.pxd":851
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_12 = __pyx_f_5MACS2_2IO_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_12;
    }
    __pyx_L11:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":852
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("MACS2.IO.numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":967
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5MACS2_2IO_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "numpy.pxd":969
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "numpy.pxd":970
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":972
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "numpy.pxd":973
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "numpy.pxd":974
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "numpy.pxd":975
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":977
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5MACS2_2IO_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "numpy.pxd":978
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  if (__pyx_t_1) {

    /* "numpy.pxd":979
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":981
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)o);
  p->filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->gzipped = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
  p->fhd = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser(PyObject *o) {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->filename);
  Py_CLEAR(p->gzipped);
  Py_CLEAR(p->fhd);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)o;
  if (p->filename) {
    e = (*v)(p->filename, a); if (e) return e;
  }
  if (p->gzipped) {
    e = (*v)(((PyObject*)p->gzipped), a); if (e) return e;
  }
  if (p->fhd) {
    e = (*v)(p->fhd, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser(PyObject *o) {
  struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->filename);
  p->filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gzipped);
  p->gzipped = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fhd);
  p->fhd = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_GenericParser[] = {
  {__Pyx_NAMESTR("tsize"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_3tsize, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_2tsize)},
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_5__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_4__tlen_parse_line)},
  {__Pyx_NAMESTR("build_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_7build_fwtrack, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_6build_fwtrack)},
  {__Pyx_NAMESTR("append_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_9append_fwtrack, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_8append_fwtrack)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_11__fw_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_10__fw_parse_line)},
  {__Pyx_NAMESTR("sniff"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_13sniff, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_12sniff)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_13GenericParser_15close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_13GenericParser_14close)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_GenericParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.GenericParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_GenericParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Generic Parser class.\n\n    Inherit this class to write your own parser. In most cases, you need to override:\n\n    1. __tlen_parse_line which returns tag length of a line\n    2.  __fw_parse_line which returns tuple of ( chromosome, 5'position, strand )\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_GenericParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BEDParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_BEDParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_9BEDParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BEDParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_BEDParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.BEDParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_BEDParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for tabular File.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_BEDParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_BEDParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_PySAMParser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)o);
  p->filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->gzipped = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
  p->fhd = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5MACS2_2IO_7cParser_PySAMParser(PyObject *o) {
  struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->filename);
  Py_CLEAR(p->gzipped);
  Py_CLEAR(p->fhd);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5MACS2_2IO_7cParser_PySAMParser(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)o;
  if (p->filename) {
    e = (*v)(p->filename, a); if (e) return e;
  }
  if (p->gzipped) {
    e = (*v)(((PyObject*)p->gzipped), a); if (e) return e;
  }
  if (p->fhd) {
    e = (*v)(p->fhd, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5MACS2_2IO_7cParser_PySAMParser(PyObject *o) {
  struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *p = (struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->filename);
  p->filename = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->gzipped);
  p->gzipped = ((PyBoolObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fhd);
  p->fhd = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_PySAMParser[] = {
  {__Pyx_NAMESTR("tsize"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_3tsize, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_2tsize)},
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_5__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_4__tlen_parse_line)},
  {__Pyx_NAMESTR("build_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_7build_fwtrack, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_6build_fwtrack)},
  {__Pyx_NAMESTR("append_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_9append_fwtrack, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_8append_fwtrack)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_11__fw_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_10__fw_parse_line)},
  {__Pyx_NAMESTR("sniff"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_13sniff, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_12sniff)},
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_15close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11PySAMParser_14close)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_PySAMParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.PySAMParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_PySAMParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_PySAMParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Parser using PySAM to parse SAM or BAM\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_PySAMParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_PySAMParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_PySAMParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5MACS2_2IO_7cParser_11PySAMParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_PySAMParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDResultParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_ELANDResultParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_17ELANDResultParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17ELANDResultParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_ELANDResultParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.ELANDResultParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_ELANDResultParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for tabular File.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_ELANDResultParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_ELANDResultParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser __pyx_vtable_5MACS2_2IO_7cParser_BAMParser;

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BAMParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *p;
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *)o);
  p->__pyx_vtab = __pyx_vtabptr_5MACS2_2IO_7cParser_BAMParser;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_BAMParser[] = {
  {__Pyx_NAMESTR("sniff"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_3sniff, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_9BAMParser_2sniff)},
  {__Pyx_NAMESTR("tsize"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_5tsize, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_references"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_7get_references, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("build_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_9build_fwtrack, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("append_fwtrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_11append_fwtrack, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__fw_binary_parse"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9BAMParser_13__fw_binary_parse, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_BAMParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.BAMParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for BAM File.\n\n    File is gzip-compatible and binary.\n    Information available is the same that is in SAM format.\n    \n    The bitwise flag is made like this:\n    dec\tmeaning\n    ---\t-------\n    1\tpaired read\n    2\tproper pair\n    4\tquery unmapped\n    8\tmate unmapped\n    16\tstrand of the query (1 -> reverse)\n    32\tstrand of the mate\n    64\tfirst read in pair\n    128\tsecond read in pair\n    256\talignment is not primary\n    512\tdoes not pass quality check\n    1024\tPCR or optical duplicate\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_BAMParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5MACS2_2IO_7cParser_9BAMParser_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_BAMParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMPEParser __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser;

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BAMPEParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *p;
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_BAMParser(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5MACS2_2IO_7cParser_BAMParser*)__pyx_vtabptr_5MACS2_2IO_7cParser_BAMPEParser;
  return o;
}

static PyObject *__pyx_getprop_5MACS2_2IO_7cParser_11BAMPEParser_n(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_1__get__(o);
}

static int __pyx_setprop_5MACS2_2IO_7cParser_11BAMPEParser_n(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1n_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5MACS2_2IO_7cParser_11BAMPEParser_d(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_1__get__(o);
}

static int __pyx_setprop_5MACS2_2IO_7cParser_11BAMPEParser_d(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1d_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_BAMPEParser[] = {
  {__Pyx_NAMESTR("build_petrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_1build_petrack, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("append_petrack"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_11BAMPEParser_3append_petrack, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_11BAMPEParser_2append_petrack)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5MACS2_2IO_7cParser_BAMPEParser[] = {
  {(char *)"n", __pyx_getprop_5MACS2_2IO_7cParser_11BAMPEParser_n, __pyx_setprop_5MACS2_2IO_7cParser_11BAMPEParser_n, 0, 0},
  {(char *)"d", __pyx_getprop_5MACS2_2IO_7cParser_11BAMPEParser_d, __pyx_setprop_5MACS2_2IO_7cParser_11BAMPEParser_d, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_BAMPEParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.BAMPEParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for BAM File containing paired-end reads\n    Only counts valid pairs, discards everything else\n    Uses the midpoint of every read and calculates the average fragment size\n    on the fly instead of modeling it\n\n    File is gzip-compatible and binary.\n    Information available is the same that is in SAM format.\n    \n    The bitwise flag is made like this:\n    dec    meaning\n    ---    -------\n    1    paired read\n    2    proper pair\n    4    query unmapped\n    8    mate unmapped\n    16    strand of the query (1 -> reverse)\n    32    strand of the mate\n    64    first read in pair\n    128    second read in pair\n    256    alignment is not primary\n    512    does not pass quality check\n    1024    PCR or optical duplicate\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_BAMPEParser, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5MACS2_2IO_7cParser_BAMPEParser, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_9BAMParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_BAMPEParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDMultiParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_ELANDMultiParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_16ELANDMultiParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_16ELANDMultiParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_ELANDMultiParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.ELANDMultiParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_ELANDMultiParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for ELAND multi File.\n\n    Note this parser can only work for s_N_eland_multi.txt format.\n\n    Each line of the output file contains the following fields: \n    1. Sequence name \n    2. Sequence \n    3. Either NM, QC, RM (as described above) or the following: \n    4. x:y:z where x, y, and z are the number of exact, single-error, and 2-error matches \n    found \n    5. Blank, if no matches found or if too many matches found, or the following: \n    BAC_plus_vector.fa:163022R1,170128F2,E_coli.fa:3909847R1 \n    This says there are two matches to BAC_plus_vector.fa: one in the reverse direction \n    starting at position 160322 with one error, one in the forward direction starting at \n    position 170128 with two errors. There is also a single-error match to E_coli.fa.\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_ELANDMultiParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_ELANDMultiParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_ELANDExportParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_ELANDExportParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_17ELANDExportParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_17ELANDExportParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_ELANDExportParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.ELANDExportParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_ELANDExportParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for ELAND Export File.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_ELANDExportParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_ELANDExportParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_SAMParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_SAMParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_9SAMParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_9SAMParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_SAMParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.SAMParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_SAMParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for SAM File.\n\n    Each line of the output file contains at least: \n    1. Sequence name \n    2. Bitwise flag\n    3. Reference name\n    4. 1-based leftmost position fo clipped alignment\n    5. Mapping quality\n    6. CIGAR string\n    7. Mate Reference Name\n    8. 1-based leftmost Mate Position\n    9. Inferred insert size\n    10. Query sequence on the same strand as the reference\n    11. Query quality\n    \n    The bitwise flag is made like this:\n    dec\tmeaning\n    ---\t-------\n    1\tpaired read\n    2\tproper pair\n    4\tquery unmapped\n    8\tmate unmapped\n    16\tstrand of the query (1 -> reverse)\n    32\tstrand of the mate\n    64\tfirst read in pair\n    128\tsecond read in pair\n    256\talignment is not primary\n    512\tdoes not pass quality check\n    1024\tPCR or optical duplicate\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_SAMParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_SAMParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_5MACS2_2IO_7cParser_BowtieParser(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_5MACS2_2IO_7cParser_GenericParser(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static PyMethodDef __pyx_methods_5MACS2_2IO_7cParser_BowtieParser[] = {
  {__Pyx_NAMESTR("__tlen_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_1__tlen_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_12BowtieParser___tlen_parse_line)},
  {__Pyx_NAMESTR("__fw_parse_line"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_12BowtieParser_3__fw_parse_line, METH_O, __Pyx_DOCSTR(__pyx_doc_5MACS2_2IO_7cParser_12BowtieParser_2__fw_parse_line)},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5MACS2_2IO_7cParser_BowtieParser = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("MACS2.IO.cParser.BowtieParser"), /*tp_name*/
  sizeof(struct __pyx_obj_5MACS2_2IO_7cParser_BowtieParser), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5MACS2_2IO_7cParser_GenericParser, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("File Parser Class for map files from Bowtie or MAQ's maqview\n    program.\n\n    "), /*tp_doc*/
  __pyx_tp_traverse_5MACS2_2IO_7cParser_GenericParser, /*tp_traverse*/
  __pyx_tp_clear_5MACS2_2IO_7cParser_GenericParser, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5MACS2_2IO_7cParser_BowtieParser, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_pw_5MACS2_2IO_7cParser_13GenericParser_1__init__, /*tp_init*/
  #else
  0, /*tp_init*/
  #endif
  0, /*tp_alloc*/
  __pyx_tp_new_5MACS2_2IO_7cParser_BowtieParser, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("guess_parser"), (PyCFunction)__pyx_pw_5MACS2_2IO_7cParser_1guess_parser, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static char* __pyx_import_star_type_names[] = {
  "int32_t",
  "BowtieParser",
  "size_t",
  "ELANDExportParser",
  "BAMParser",
  "bool",
  "PySAMParser",
  "BEDParser",
  "BAMPEParser",
  "ELANDMultiParser",
  "SAMParser",
  "GenericParser",
  "ELANDResultParser",
  "_BAMPEParsed",
  "uint32_t",
  "uint64_t",
  0
};

static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
  char** type_name = __pyx_import_star_type_names;
  while (*type_name) {
    if (__Pyx_StrEq(name, *type_name)) {
      PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
      goto bad;
    }
    type_name++;
  }
  if (0);
  else if (__Pyx_StrEq(name, "HAS_PYSAM")) {
    HAS_PYSAM = __Pyx_PyObject_IsTrue(o); if ((HAS_PYSAM == (int)-1) && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L2_error;};
  }
  else {
    if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
  }
  return 0;
  __pyx_L2_error:;
  __Pyx_AddTraceback("MACS2.IO.cParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  bad:
  return -1;
}


/* import_all_from is an unexposed function from ceval.c */

static int
__Pyx_import_all_from(PyObject *locals, PyObject *v)
{
    PyObject *all = __Pyx_GetAttrString(v, "__all__");
    PyObject *dict, *name, *value;
    int skip_leading_underscores = 0;
    int pos, err;

    if (all == NULL) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            return -1; /* Unexpected error */
        PyErr_Clear();
        dict = __Pyx_GetAttrString(v, "__dict__");
        if (dict == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError))
                return -1;
            PyErr_SetString(PyExc_ImportError,
            "from-import-* object has no __dict__ and no __all__");
            return -1;
        }
#if PY_MAJOR_VERSION < 3
        all = PyObject_CallMethod(dict, (char *)"keys", NULL);
#else
        all = PyMapping_Keys(dict);
#endif
        Py_DECREF(dict);
        if (all == NULL)
            return -1;
        skip_leading_underscores = 1;
    }

    for (pos = 0, err = 0; ; pos++) {
        name = PySequence_GetItem(all, pos);
        if (name == NULL) {
            if (!PyErr_ExceptionMatches(PyExc_IndexError))
                err = -1;
            else
                PyErr_Clear();
            break;
        }
        if (skip_leading_underscores &&
#if PY_MAJOR_VERSION < 3
            PyString_Check(name) &&
            PyString_AS_STRING(name)[0] == '_')
#else
            PyUnicode_Check(name) &&
            PyUnicode_AS_UNICODE(name)[0] == '_')
#endif
        {
            Py_DECREF(name);
            continue;
        }
        value = PyObject_GetAttr(v, name);
        if (value == NULL)
            err = -1;
        else if (PyDict_CheckExact(locals))
            err = PyDict_SetItem(locals, name, value);
        else
            err = PyObject_SetItem(locals, name, value);
        Py_DECREF(name);
        Py_XDECREF(value);
        if (err != 0)
            break;
    }
    Py_DECREF(all);
    return err;
}


static int __pyx_import_star(PyObject* m) {

    int i;
    int ret = -1;
    char* s;
    PyObject *locals = 0;
    PyObject *list = 0;
#if PY_MAJOR_VERSION >= 3
    PyObject *utf8_name = 0;
#endif
    PyObject *name;
    PyObject *item;

    locals = PyDict_New();              if (!locals) goto bad;
    if (__Pyx_import_all_from(locals, m) < 0) goto bad;
    list = PyDict_Items(locals);        if (!list) goto bad;

    for(i=0; i<PyList_GET_SIZE(list); i++) {
        name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
        item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
#if PY_MAJOR_VERSION >= 3
        utf8_name = PyUnicode_AsUTF8String(name);
        if (!utf8_name) goto bad;
        s = PyBytes_AS_STRING(utf8_name);
        if (__pyx_import_star_set(item, name, s) < 0) goto bad;
        Py_DECREF(utf8_name); utf8_name = 0;
#else
        s = PyString_AsString(name);
        if (!s) goto bad;
        if (__pyx_import_star_set(item, name, s) < 0) goto bad;
#endif
    }
    ret = 0;

bad:
    Py_XDECREF(locals);
    Py_XDECREF(list);
#if PY_MAJOR_VERSION >= 3
    Py_XDECREF(utf8_name);
#endif
    return ret;
}


#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("cParser"),
    __Pyx_DOCSTR(__pyx_k_114), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_u_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 1, 0, 0},
  {&__pyx_kp_u_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 1, 0, 0},
  {&__pyx_kp_u_106, __pyx_k_106, sizeof(__pyx_k_106), 0, 1, 0, 0},
  {&__pyx_kp_u_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 1, 0, 0},
  {&__pyx_kp_u_109, __pyx_k_109, sizeof(__pyx_k_109), 0, 1, 0, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_u_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 1, 0, 0},
  {&__pyx_n_s_115, __pyx_k_115, sizeof(__pyx_k_115), 0, 0, 1, 1},
  {&__pyx_n_s_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 0, 1, 1},
  {&__pyx_n_s_117, __pyx_k_117, sizeof(__pyx_k_117), 0, 0, 1, 1},
  {&__pyx_n_s_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 0, 1, 1},
  {&__pyx_kp_s_119, __pyx_k_119, sizeof(__pyx_k_119), 0, 0, 1, 0},
  {&__pyx_kp_s_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 0, 1, 0},
  {&__pyx_kp_s_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 0, 1, 0},
  {&__pyx_kp_s_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 0, 1, 0},
  {&__pyx_n_s_125, __pyx_k_125, sizeof(__pyx_k_125), 0, 0, 1, 1},
  {&__pyx_n_s_126, __pyx_k_126, sizeof(__pyx_k_126), 0, 0, 1, 1},
  {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1},
  {&__pyx_kp_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
  {&__pyx_n_s__BAM, __pyx_k__BAM, sizeof(__pyx_k__BAM), 0, 0, 1, 1},
  {&__pyx_n_s__BED, __pyx_k__BED, sizeof(__pyx_k__BED), 0, 0, 1, 1},
  {&__pyx_n_s__BOWTIE, __pyx_k__BOWTIE, sizeof(__pyx_k__BOWTIE), 0, 0, 1, 1},
  {&__pyx_n_s__BufferedReader, __pyx_k__BufferedReader, sizeof(__pyx_k__BufferedReader), 0, 0, 1, 1},
  {&__pyx_n_s__ELAND, __pyx_k__ELAND, sizeof(__pyx_k__ELAND), 0, 0, 1, 1},
  {&__pyx_n_s__ELANDEXPORT, __pyx_k__ELANDEXPORT, sizeof(__pyx_k__ELANDEXPORT), 0, 0, 1, 1},
  {&__pyx_n_s__ELANDMULTI, __pyx_k__ELANDMULTI, sizeof(__pyx_k__ELANDMULTI), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1},
  {&__pyx_n_s__FWTrackIII, __pyx_k__FWTrackIII, sizeof(__pyx_k__FWTrackIII), 0, 0, 1, 1},
  {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1},
  {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s__PETrackI, __pyx_k__PETrackI, sizeof(__pyx_k__PETrackI), 0, 0, 1, 1},
  {&__pyx_n_s__R, __pyx_k__R, sizeof(__pyx_k__R), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__SAM, __pyx_k__SAM, sizeof(__pyx_k__SAM), 0, 0, 1, 1},
  {&__pyx_n_s__Samfile, __pyx_k__Samfile, sizeof(__pyx_k__Samfile), 0, 0, 1, 1},
  {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s__StrandFormatError, __pyx_k__StrandFormatError, sizeof(__pyx_k__StrandFormatError), 0, 0, 1, 1},
  {&__pyx_n_s__U0, __pyx_k__U0, sizeof(__pyx_k__U0), 0, 0, 1, 1},
  {&__pyx_n_s__U1, __pyx_k__U1, sizeof(__pyx_k__U1), 0, 0, 1, 1},
  {&__pyx_n_s__U2, __pyx_k__U2, sizeof(__pyx_k__U2), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____doc__, __pyx_k____doc__, sizeof(__pyx_k____doc__), 0, 0, 1, 1},
  {&__pyx_n_s____fw_binary_parse, __pyx_k____fw_binary_parse, sizeof(__pyx_k____fw_binary_parse), 0, 0, 1, 1},
  {&__pyx_n_s____fw_parse_line, __pyx_k____fw_parse_line, sizeof(__pyx_k____fw_parse_line), 0, 0, 1, 1},
  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
  {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
  {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
  {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s____tlen_parse_line, __pyx_k____tlen_parse_line, sizeof(__pyx_k____tlen_parse_line), 0, 0, 1, 1},
  {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
  {&__pyx_n_s__add_loc, __pyx_k__add_loc, sizeof(__pyx_k__add_loc), 0, 0, 1, 1},
  {&__pyx_n_s__append_fwtrack, __pyx_k__append_fwtrack, sizeof(__pyx_k__append_fwtrack), 0, 0, 1, 1},
  {&__pyx_n_s__append_petrack, __pyx_k__append_petrack, sizeof(__pyx_k__append_petrack), 0, 0, 1, 1},
  {&__pyx_n_s__browser, __pyx_k__browser, sizeof(__pyx_k__browser), 0, 0, 1, 1},
  {&__pyx_n_s__build_fwtrack, __pyx_k__build_fwtrack, sizeof(__pyx_k__build_fwtrack), 0, 0, 1, 1},
  {&__pyx_n_s__build_petrack, __pyx_k__build_petrack, sizeof(__pyx_k__build_petrack), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
  {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
  {&__pyx_n_s__finalize, __pyx_k__finalize, sizeof(__pyx_k__finalize), 0, 0, 1, 1},
  {&__pyx_n_s__get_references, __pyx_k__get_references, sizeof(__pyx_k__get_references), 0, 0, 1, 1},
  {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
  {&__pyx_n_s__info, __pyx_k__info, sizeof(__pyx_k__info), 0, 0, 1, 1},
  {&__pyx_n_s__io, __pyx_k__io, sizeof(__pyx_k__io), 0, 0, 1, 1},
  {&__pyx_n_s__is_paired, __pyx_k__is_paired, sizeof(__pyx_k__is_paired), 0, 0, 1, 1},
  {&__pyx_n_s__is_proper_pair, __pyx_k__is_proper_pair, sizeof(__pyx_k__is_proper_pair), 0, 0, 1, 1},
  {&__pyx_n_s__is_read2, __pyx_k__is_read2, sizeof(__pyx_k__is_read2), 0, 0, 1, 1},
  {&__pyx_n_s__is_reverse, __pyx_k__is_reverse, sizeof(__pyx_k__is_reverse), 0, 0, 1, 1},
  {&__pyx_n_s__is_unmapped, __pyx_k__is_unmapped, sizeof(__pyx_k__is_unmapped), 0, 0, 1, 1},
  {&__pyx_n_s__isdigit, __pyx_k__isdigit, sizeof(__pyx_k__isdigit), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__lengths, __pyx_k__lengths, sizeof(__pyx_k__lengths), 0, 0, 1, 1},
  {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1},
  {&__pyx_n_s__map, __pyx_k__map, sizeof(__pyx_k__map), 0, 0, 1, 1},
  {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
  {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
  {&__pyx_n_s__pysam, __pyx_k__pysam, sizeof(__pyx_k__pysam), 0, 0, 1, 1},
  {&__pyx_n_s__qlen, __pyx_k__qlen, sizeof(__pyx_k__qlen), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__rb, __pyx_k__rb, sizeof(__pyx_k__rb), 0, 0, 1, 1},
  {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1},
  {&__pyx_n_s__readline, __pyx_k__readline, sizeof(__pyx_k__readline), 0, 0, 1, 1},
  {&__pyx_n_s__references, __pyx_k__references, sizeof(__pyx_k__references), 0, 0, 1, 1},
  {&__pyx_n_s__reset, __pyx_k__reset, sizeof(__pyx_k__reset), 0, 0, 1, 1},
  {&__pyx_n_s__rindex, __pyx_k__rindex, sizeof(__pyx_k__rindex), 0, 0, 1, 1},
  {&__pyx_n_s__rlen, __pyx_k__rlen, sizeof(__pyx_k__rlen), 0, 0, 1, 1},
  {&__pyx_n_s__rlengths, __pyx_k__rlengths, sizeof(__pyx_k__rlengths), 0, 0, 1, 1},
  {&__pyx_n_s__rstrip, __pyx_k__rstrip, sizeof(__pyx_k__rstrip), 0, 0, 1, 1},
  {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__set_rlengths, __pyx_k__set_rlengths, sizeof(__pyx_k__set_rlengths), 0, 0, 1, 1},
  {&__pyx_n_s__sniff, __pyx_k__sniff, sizeof(__pyx_k__sniff), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__strand, __pyx_k__strand, sizeof(__pyx_k__strand), 0, 0, 1, 1},
  {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1},
  {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
  {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1},
  {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1},
  {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
  {&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1},
  {&__pyx_n_s__tsize, __pyx_k__tsize, sizeof(__pyx_k__tsize), 0, 0, 1, 1},
  {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1},
  {&__pyx_n_s__zip, __pyx_k__zip, sizeof(__pyx_k__zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s__sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s__map); if (!__pyx_builtin_map) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "MACS2/IO/cParser.pyx":68
 * 
 * cpdef guess_parser ( fhd ):
 *     order_list = ("BAM",             # <<<<<<<<<<<<<<
 *                   "BED",
 *                   "ELAND",
 */
  __pyx_k_tuple_1 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__BAM), ((PyObject *)__pyx_n_s__BED), ((PyObject *)__pyx_n_s__ELAND), ((PyObject *)__pyx_n_s__ELANDMULTI), ((PyObject *)__pyx_n_s__ELANDEXPORT), ((PyObject *)__pyx_n_s__SAM), ((PyObject *)__pyx_n_s__BOWTIE)); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1));

  /* "MACS2/IO/cParser.pyx":96
 *             logging.info( "Detected format is: %s" % ( f ) )
 *             if p.gzipped:
 *                 logging.info( "* Input file is gzipped." )             # <<<<<<<<<<<<<<
 *             return p
 *         else:
 */
  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_4);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "MACS2/IO/cParser.pyx":100
 *         else:
 *             p.close()
 *     raise Exception( "Can't detect format!" )             # <<<<<<<<<<<<<<
 * 
 * # ------------------------------------
 */
  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_6);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

  /* "MACS2/IO/cParser.pyx":148
 *         f = gzip.open( filename )
 *         try:
 *             f.read( 10 )             # <<<<<<<<<<<<<<
 *         except IOError:
 *             # not a gzipped file
 */
  __pyx_k_tuple_8 = PyTuple_Pack(1, __pyx_int_10); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_8);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));

  /* "MACS2/IO/cParser.pyx":186
 *                 n += 1
 *         # done
 *         self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = s/n
 *         return self.tag_size
 */
  __pyx_k_tuple_9 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_9);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "MACS2/IO/cParser.pyx":283
 *         else:
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
  __pyx_k_tuple_12 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_12);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "MACS2/IO/cParser.pyx":286
 *                 return False
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
  __pyx_k_tuple_13 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_13);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));

  /* "MACS2/IO/cParser.pyx":279
 *             t = self.tsize()
 *         except:
 *             self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_k_tuple_14 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_14);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));

  /* "MACS2/IO/cParser.pyx":311
 *             return 0
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         return atoi( thisfields[ 2 ] )-atoi( thisfields[ 1 ] )
 * 
 */
  __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_17);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));

  /* "MACS2/IO/cParser.pyx":323
 *             or thisline[ :7 ] == "browser" \
 *             or thisline[ 0 ] == "#":
 *              return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_k_tuple_18 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_18);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "MACS2/IO/cParser.pyx":325
 *              return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         chromname = thisfields[ 0 ]
 *         #try:
 */
  __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_19);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "MACS2/IO/cParser.pyx":361
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if thisfields[1].isdigit():
 *             return 0
 */
  __pyx_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_22);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "MACS2/IO/cParser.pyx":373
 *         #if thisline.startswith("#") or thisline.startswith("track") or thisline.startswith("browser"): return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_k_tuple_23 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_23);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "MACS2/IO/cParser.pyx":375
 *         if not thisline: return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistaglength = strlen( thisfields[ 1 ] )
 * 
 */
  __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_24);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));

  /* "MACS2/IO/cParser.pyx":379
 * 
 *         if len( thisfields ) <= 6:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_k_tuple_25 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_25);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));

  /* "MACS2/IO/cParser.pyx":383
 *         try:
 *             chromname = thisfields[ 6 ]
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_27);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "MACS2/IO/cParser.pyx":401
 *                 raise StrandFormatError( thisline, strand )
 *         else:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 * cdef class ELANDMultiParser( GenericParser ):
 */
  __pyx_k_tuple_28 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_28);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));

  /* "MACS2/IO/cParser.pyx":426
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if thisfields[1].isdigit():
 *             return 0
 */
  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_29);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "MACS2/IO/cParser.pyx":438
 *             int thistaglength, thistaghits
 * 
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 */
  __pyx_k_tuple_30 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_30);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));

  /* "MACS2/IO/cParser.pyx":440
 *         if not thisline: return ( "", -1, -1 )
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         #if thisline[ 0 ] == "#": return ( "", -1, -1 ) # comment line is skipped
 */
  __pyx_k_tuple_31 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_31);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));

  /* "MACS2/IO/cParser.pyx":444
 *         #if thisline[ 0 ] == "#": return ( "", -1, -1 ) # comment line is skipped
 * 
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistagname = thisfields[ 0 ]        # name of tag
 *         thistaglength = len( thisfields[ 1 ] ) # length of tag
 */
  __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_32);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));

  /* "MACS2/IO/cParser.pyx":449
 * 
 *         if len( thisfields ) < 4:
 *             return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         else:
 *             thistaghits = sum( map( int, thisfields[ 2 ].split( ':' ) ) )
 */
  __pyx_k_tuple_33 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_33);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));

  /* "MACS2/IO/cParser.pyx":451
 *             return ( "", -1, -1 )
 *         else:
 *             thistaghits = sum( map( int, thisfields[ 2 ].split( ':' ) ) )             # <<<<<<<<<<<<<<
 *             if thistaghits > 1:
 *                 # multiple hits
 */
  __pyx_k_tuple_35 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_34)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_35);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));

  /* "MACS2/IO/cParser.pyx":454
 *             if thistaghits > 1:
 *                 # multiple hits
 *                 return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *             else:
 *                 ( chromname, pos ) = thisfields[ 3 ].split( ':' )
 */
  __pyx_k_tuple_36 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_36);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));

  /* "MACS2/IO/cParser.pyx":456
 *                 return ( "", -1, -1 )
 *             else:
 *                 ( chromname, pos ) = thisfields[ 3 ].split( ':' )             # <<<<<<<<<<<<<<
 * 
 *                 try:
 */
  __pyx_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_34)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_37);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));

  /* "MACS2/IO/cParser.pyx":459
 * 
 *                 try:
 *                     chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *                 except ValueError:
 *                     pass
 */
  __pyx_k_tuple_38 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_38);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));

  /* "MACS2/IO/cParser.pyx":486
 *         thisline = thisline.rstrip()
 *         if not thisline: return 0
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         if len( thisfields ) > 12 and thisfields[ 12 ]:
 *             # a successful alignment has over 12 columns
 */
  __pyx_k_tuple_39 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_39);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));

  /* "MACS2/IO/cParser.pyx":501
 *         #if thisline.startswith("#") : return ("comment line",None,None) # comment line is skipped
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisfields = thisline.split( "\t" )
 */
  __pyx_k_tuple_40 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_40);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));

  /* "MACS2/IO/cParser.pyx":503
 *         if not thisline: return ( "", -1, -1 )
 * 
 *         thisfields = thisline.split( "\t" )             # <<<<<<<<<<<<<<
 * 
 *         if len(thisfields) > 12 and thisfields[ 12 ]:
 */
  __pyx_k_tuple_41 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_41);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));

  /* "MACS2/IO/cParser.pyx":516
 *                 raise StrandFormatError( thisline, strand )
 *         else:
 *             return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 * 
 * ### Contributed by Davide, modified by Tao
 */
  __pyx_k_tuple_42 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_42);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));

  /* "MACS2/IO/cParser.pyx":562
 *         if not thisline: return 0
 *         if thisline[ 0 ] == "@": return 0 # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  __pyx_k_tuple_44 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_44);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));

  /* "MACS2/IO/cParser.pyx":586
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )
 */
  __pyx_k_tuple_45 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_45);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));

  /* "MACS2/IO/cParser.pyx":587
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' )
 *         thistagname = thisfields[ 0 ]         # name of tag
 */
  __pyx_k_tuple_46 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_46);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));

  /* "MACS2/IO/cParser.pyx":588
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ] == "@": return ( "", -1, -1 ) # header line started with '@' is skipped
 *         thisfields = thisline.split( '\t' )             # <<<<<<<<<<<<<<
 *         thistagname = thisfields[ 0 ]         # name of tag
 *         thisref = thisfields[ 2 ]
 */
  __pyx_k_tuple_47 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_47);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));

  /* "MACS2/IO/cParser.pyx":593
 *         bwflag = atoi( thisfields[ 1 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( "", -1, -1 )       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
  __pyx_k_tuple_48 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_48);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));

  /* "MACS2/IO/cParser.pyx":598
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return ( "", -1, -1 )   # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return ( "", -1, -1 )   # the mate is unmapped
 */
  __pyx_k_tuple_49 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_49);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));

  /* "MACS2/IO/cParser.pyx":600
 *                 return ( "", -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 *                 return ( "", -1, -1 )   # the mate is unmapped             # <<<<<<<<<<<<<<
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:
 */
  __pyx_k_tuple_50 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_50);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));

  /* "MACS2/IO/cParser.pyx":604
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *             # end of the patch
 *         # In case of paired-end we have now skipped all possible "bad" pairs
 */
  __pyx_k_tuple_51 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_51);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51));

  /* "MACS2/IO/cParser.pyx":618
 * 
 *         try:
 *             thisref = thisref[ :thisref.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
  __pyx_k_tuple_52 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_52);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));

  /* "MACS2/IO/cParser.pyx":664
 *             f = gzip.open( filename )
 *             try:
 *                 f.read( 10 )             # <<<<<<<<<<<<<<
 *             except IOError:
 *                 # not a gzipped file
 */
  __pyx_k_tuple_53 = PyTuple_Pack(1, __pyx_int_10); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_53);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));

  /* "MACS2/IO/cParser.pyx":688
 *                 return True
 *         else:
 *             magic_header = self.fhd.read( 3 )             # <<<<<<<<<<<<<<
 *             if magic_header == "BAM":
 *                 tsize  = self.tsize()
 */
  __pyx_k_tuple_54 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_54);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));

  /* "MACS2/IO/cParser.pyx":692
 *                 tsize  = self.tsize()
 *                 if tsize > 0:
 *                     self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                     return True
 *                 else:
 */
  __pyx_k_tuple_55 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));

  /* "MACS2/IO/cParser.pyx":695
 *                     return True
 *                 else:
 *                     self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                     raise Exception( "File is not of a valid BAM format! %d" % tsize )
 *             else:
 */
  __pyx_k_tuple_56 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_56);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));

  /* "MACS2/IO/cParser.pyx":698
 *                     raise Exception( "File is not of a valid BAM format! %d" % tsize )
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_k_tuple_58 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_58);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));

  /* "MACS2/IO/cParser.pyx":747
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 *         fseek( 4 )             # <<<<<<<<<<<<<<
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )
 */
  __pyx_k_tuple_59 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_59);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));

  /* "MACS2/IO/cParser.pyx":748
 *         # move to pos 4, there starts something
 *         fseek( 4 )
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 */
  __pyx_k_tuple_61 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_61);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));

  /* "MACS2/IO/cParser.pyx":751
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         for x in range( nc ):
 *             # read each chromosome name
 */
  __pyx_k_tuple_62 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_62);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));

  /* "MACS2/IO/cParser.pyx":754
 *         for x in range( nc ):
 *             # read each chromosome name
 *             nlength = unpack( '<i' , fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             # jump over chromosome size, we don't need it
 *             fread( nlength )
 */
  __pyx_k_tuple_63 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_63);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));

  /* "MACS2/IO/cParser.pyx":759
 *             fseek( ftell() + 4 )
 *         while n < 10:
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             data = fread( entrylength )
 *             a = unpack( '<i', data[16:20] )[ 0 ]
 */
  __pyx_k_tuple_64 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_64);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));

  /* "MACS2/IO/cParser.pyx":761
 *             entrylength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             data = fread( entrylength )
 *             a = unpack( '<i', data[16:20] )[ 0 ]             # <<<<<<<<<<<<<<
 *             s += a
 *             n += 1
 */
  __pyx_k_slice_65 = PySlice_New(__pyx_int_16, __pyx_int_20, Py_None); if (unlikely(!__pyx_k_slice_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_65);
  __Pyx_GIVEREF(__pyx_k_slice_65);

  /* "MACS2/IO/cParser.pyx":764
 *             s += a
 *             n += 1
 *         fseek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = int( s/n )
 *         return self.tag_size
 */
  __pyx_k_tuple_66 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_66);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));

  /* "MACS2/IO/cParser.pyx":806
 *         ftell = self.fhd.tell
 *         # move to pos 4, there starts something
 *         fseek(4)             # <<<<<<<<<<<<<<
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]
 *         fseek( header_len + ftell() )
 */
  __pyx_k_tuple_67 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_67);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));

  /* "MACS2/IO/cParser.pyx":807
 *         # move to pos 4, there starts something
 *         fseek(4)
 *         header_len =  unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 */
  __pyx_k_tuple_68 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_68);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));

  /* "MACS2/IO/cParser.pyx":810
 *         fseek( header_len + ftell() )
 *         # get the number of chromosome
 *         nc = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         for x in range( nc ):
 *             # read each chromosome name
 */
  __pyx_k_tuple_69 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_69);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));

  /* "MACS2/IO/cParser.pyx":813
 *         for x in range( nc ):
 *             # read each chromosome name
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             refname = fread( nlength )[ :-1 ]
 *             references.append( refname )
 */
  __pyx_k_tuple_70 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_70);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));

  /* "MACS2/IO/cParser.pyx":814
 *             # read each chromosome name
 *             nlength = unpack( '<i', fread( 4 ) )[ 0 ]
 *             refname = fread( nlength )[ :-1 ]             # <<<<<<<<<<<<<<
 *             references.append( refname )
 *             # don't jump over chromosome size
 */
  __pyx_k_slice_71 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_k_slice_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_71);
  __Pyx_GIVEREF(__pyx_k_slice_71);

  /* "MACS2/IO/cParser.pyx":818
 *             # don't jump over chromosome size
 *             # we can use it to avoid falling of chrom ends during peak calling
 *             rlengths[refname] = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *         return (references, rlengths)
 * 
 */
  __pyx_k_tuple_72 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_72);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));

  /* "MACS2/IO/cParser.pyx":885
 *         while True:
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             except struct.error:
 *                 break
 */
  __pyx_k_tuple_73 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_73);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));

  /* "MACS2/IO/cParser.pyx":964
 *         while True:
 *             try:
 *                 entrylength = unpack( '<i', fread( 4 ) )[ 0 ]             # <<<<<<<<<<<<<<
 *             except struct.error:
 *                 break
 */
  __pyx_k_tuple_74 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_74);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));

  /* "MACS2/IO/cParser.pyx":986
 * 
 *         # we skip lot of the available information in data (i.e. tag name, quality etc etc)
 *         if not data: return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 */
  __pyx_k_tuple_75 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_75);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));

  /* "MACS2/IO/cParser.pyx":988
 *         if not data: return ( -1, -1, -1 )
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]             # <<<<<<<<<<<<<<
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 */
  __pyx_k_slice_76 = PySlice_New(__pyx_int_0, __pyx_int_4, Py_None); if (unlikely(!__pyx_k_slice_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_76);
  __Pyx_GIVEREF(__pyx_k_slice_76);

  /* "MACS2/IO/cParser.pyx":989
 * 
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]             # <<<<<<<<<<<<<<
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 */
  __pyx_k_slice_77 = PySlice_New(__pyx_int_4, __pyx_int_8, Py_None); if (unlikely(!__pyx_k_slice_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_77);
  __Pyx_GIVEREF(__pyx_k_slice_77);

  /* "MACS2/IO/cParser.pyx":990
 *         thisref = unpack( '<i', data[ 0:4 ] )[ 0 ]
 *         thisstart = unpack( '<i', data[ 4:8 ] )[ 0 ]
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )             # <<<<<<<<<<<<<<
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence
 */
  __pyx_k_slice_79 = PySlice_New(__pyx_int_12, __pyx_int_16, Py_None); if (unlikely(!__pyx_k_slice_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_79);
  __Pyx_GIVEREF(__pyx_k_slice_79);

  /* "MACS2/IO/cParser.pyx":992
 *         ( cigar, bwflag ) = unpack( '<hh' , data[ 12:16 ] )
 *         if bwflag & 4 or bwflag & 512 or bwflag & 1024:
 *             return ( -1, -1, -1 )       #unmapped sequence or bad sequence             # <<<<<<<<<<<<<<
 *         if bwflag & 1:
 *             # paired read. We should only keep sequence if the mate is mapped
 */
  __pyx_k_tuple_80 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_80);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));

  /* "MACS2/IO/cParser.pyx":997
 *             # and if this is the left mate, all is within  the flag!
 *             if not bwflag & 2:
 *                 return ( -1, -1, -1 )   # not a proper pair             # <<<<<<<<<<<<<<
 *             if bwflag & 8:
 *                 return ( -1, -1, -1 )   # the mate is unmapped
 */
  __pyx_k_tuple_81 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_81);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));

  /* "MACS2/IO/cParser.pyx":999
 *                 return ( -1, -1, -1 )   # not a proper pair
 *             if bwflag & 8:
 *                 return ( -1, -1, -1 )   # the mate is unmapped             # <<<<<<<<<<<<<<
 *             # From Benjamin Schiller https://github.com/benjschiller
 *             if bwflag & 128:
 */
  __pyx_k_tuple_82 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_82);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));

  /* "MACS2/IO/cParser.pyx":1003
 *             if bwflag & 128:
 *                 # this is not the first read in a pair
 *                 return ( -1, -1, -1 )             # <<<<<<<<<<<<<<
 *             # end of the patch
 *         # In case of paired-end we have now skipped all possible "bad" pairs
 */
  __pyx_k_tuple_83 = PyTuple_Pack(3, __pyx_int_neg_1, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_83);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));

  /* "MACS2/IO/cParser.pyx":1012
 *         if bwflag & 16:
 *             thisstrand = 1
 *             thisstart = thisstart + unpack( '<i', data[ 16:20 ] )[ 0 ]	#reverse strand should be shifted len(query) bp             # <<<<<<<<<<<<<<
 *         else:
 *             thisstrand = 0
 */
  __pyx_k_slice_84 = PySlice_New(__pyx_int_16, __pyx_int_20, Py_None); if (unlikely(!__pyx_k_slice_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_84);
  __Pyx_GIVEREF(__pyx_k_slice_84);

  /* "MACS2/IO/cParser.pyx":1156
 *         err = struct.error
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]             # <<<<<<<<<<<<<<
 *             except err: break
 *             rawread = <bytes>fread(32)
 */
  __pyx_k_tuple_85 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_85);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));

  /* "MACS2/IO/cParser.pyx":1158
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 *             rawread = <bytes>fread(32)             # <<<<<<<<<<<<<<
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 */
  __pyx_k_tuple_86 = PyTuple_Pack(1, __pyx_int_32); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_86);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));

  /* "MACS2/IO/cParser.pyx":1204
 *         err = struct.error
 *         while True:
 *             try: entrylength = unpack('<i', fread(4))[0]             # <<<<<<<<<<<<<<
 *             except err: break
 *             rawread = <bytes>fread(32)
 */
  __pyx_k_tuple_88 = PyTuple_Pack(1, __pyx_int_4); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_88);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));

  /* "MACS2/IO/cParser.pyx":1206
 *             try: entrylength = unpack('<i', fread(4))[0]
 *             except err: break
 *             rawread = <bytes>fread(32)             # <<<<<<<<<<<<<<
 * #            rawread = <bytes>fread(entrylength)
 *             read = self.__pe_binary_parse(rawread)
 */
  __pyx_k_tuple_89 = PyTuple_Pack(1, __pyx_int_32); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_89);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));

  /* "MACS2/IO/cParser.pyx":1293
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 */
  __pyx_k_tuple_90 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_90);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));

  /* "MACS2/IO/cParser.pyx":1294
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 *         return len( thisfields[ 4 ] )
 */
  __pyx_k_tuple_91 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_91);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));

  /* "MACS2/IO/cParser.pyx":1295
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1 , -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble             # <<<<<<<<<<<<<<
 *         return len( thisfields[ 4 ] )
 * 
 */
  __pyx_k_tuple_92 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_92);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92));

  /* "MACS2/IO/cParser.pyx":1344
 * 
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )             # <<<<<<<<<<<<<<
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 */
  __pyx_k_tuple_93 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_93);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93));

  /* "MACS2/IO/cParser.pyx":1345
 *         thisline = thisline.rstrip()
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped             # <<<<<<<<<<<<<<
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble
 * 
 */
  __pyx_k_tuple_94 = PyTuple_Pack(3, ((PyObject *)__pyx_kp_s_11), __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_94);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));

  /* "MACS2/IO/cParser.pyx":1346
 *         if not thisline: return ( "", -1, -1 )
 *         if thisline[ 0 ]=="#": return ( "", -1, -1 ) # comment line is skipped
 *         thisfields = thisline.split( '\t' ) # I hope it will never bring me more trouble             # <<<<<<<<<<<<<<
 * 
 *         chromname = thisfields[ 2 ]
 */
  __pyx_k_tuple_95 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_16)); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_95);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));

  /* "MACS2/IO/cParser.pyx":1350
 *         chromname = thisfields[ 2 ]
 *         try:
 *             chromname = chromname[ :chromname.rindex( ".fa" ) ]             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             pass
 */
  __pyx_k_tuple_96 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_96);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));

  /* "MACS2/IO/cParser.pyx":1391
 *         f = gzip.open( filename )
 *         try:
 *             f.read( 10 )             # <<<<<<<<<<<<<<
 *         except IOError:
 *             # not a gzipped file
 */
  __pyx_k_tuple_97 = PyTuple_Pack(1, __pyx_int_10); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_97);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));

  /* "MACS2/IO/cParser.pyx":1429
 *                 n += 1
 *         # done
 *         self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *         self.tag_size = s/n
 *         return self.tag_size
 */
  __pyx_k_tuple_98 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_98);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));

  /* "MACS2/IO/cParser.pyx":1526
 *         else:
 *             if t <= 10 or t >= 10000:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
 */
  __pyx_k_tuple_99 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_99);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));

  /* "MACS2/IO/cParser.pyx":1529
 *                 return False
 *             else:
 *                 self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *                 return True
 * 
 */
  __pyx_k_tuple_100 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_100);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100));

  /* "MACS2/IO/cParser.pyx":1522
 *             t = self.tsize()
 *         except:
 *             self.fhd.seek( 0 )             # <<<<<<<<<<<<<<
 *             return False
 *         else:
 */
  __pyx_k_tuple_101 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_101);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));

  /* "numpy.pxd":215
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_k_tuple_103 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_102)); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_103);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));

  /* "numpy.pxd":219
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_k_tuple_105 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_104)); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_105);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));

  /* "numpy.pxd":257
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_k_tuple_107 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_106)); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_107);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));

  /* "numpy.pxd":801
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_k_tuple_110 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_109)); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_110);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));

  /* "numpy.pxd":805
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_k_tuple_111 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_106)); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_111);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));

  /* "numpy.pxd":825
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_k_tuple_113 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_112)); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_113);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));

  /* "MACS2/IO/cParser.pyx":111
 *     raise StrandFormatError('Must be F or R','X')
 *     """
 *     def __init__ ( self, string, strand ):             # <<<<<<<<<<<<<<
 *         self.strand = strand
 *         self.string = string
 */
  __pyx_k_tuple_122 = PyTuple_Pack(3, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__string), ((PyObject *)__pyx_n_s__strand)); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_122);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));
  __pyx_k_codeobj_123 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_124, __pyx_n_s____init__, 111, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "MACS2/IO/cParser.pyx":115
 *         self.string = string
 * 
 *     def __str__ ( self ):             # <<<<<<<<<<<<<<
 *         return repr( "Strand information can not be recognized in this line: \"%s\",\"%s\"" % ( self.string, self.strand ) )
 * 
 */
  __pyx_k_tuple_127 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_127);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_127));
  __pyx_k_codeobj_128 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_124, __pyx_n_s____str__, 115, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1000000 = PyInt_FromLong(1000000); if (unlikely(!__pyx_int_1000000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcParser(void); /*proto*/
PyMODINIT_FUNC initcParser(void)
#else
PyMODINIT_FUNC PyInit_cParser(void); /*proto*/
PyMODINIT_FUNC PyInit_cParser(void)
#endif
{
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cParser(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("cParser"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_114), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "MACS2.IO.cParser")) {
      if (unlikely(PyDict_SetItemString(modules, "MACS2.IO.cParser", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_MACS2__IO__cParser) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_GenericParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5MACS2_2IO_7cParser_GenericParser, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5MACS2_2IO_7cParser_13GenericParser___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5MACS2_2IO_7cParser_13GenericParser___init__.doc = __pyx_doc_5MACS2_2IO_7cParser_13GenericParser___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5MACS2_2IO_7cParser_13GenericParser___init__;
    }
  }
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "GenericParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_GenericParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_GenericParser = &__pyx_type_5MACS2_2IO_7cParser_GenericParser;
  __pyx_type_5MACS2_2IO_7cParser_BEDParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_BEDParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BEDParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_BEDParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_BEDParser = &__pyx_type_5MACS2_2IO_7cParser_BEDParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_PySAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5MACS2_2IO_7cParser_PySAMParser, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5MACS2_2IO_7cParser_11PySAMParser___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5MACS2_2IO_7cParser_11PySAMParser___init__.doc = __pyx_doc_5MACS2_2IO_7cParser_11PySAMParser___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5MACS2_2IO_7cParser_11PySAMParser___init__;
    }
  }
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "PySAMParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_PySAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_PySAMParser = &__pyx_type_5MACS2_2IO_7cParser_PySAMParser;
  __pyx_type_5MACS2_2IO_7cParser_ELANDResultParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_ELANDResultParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ELANDResultParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_ELANDResultParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_ELANDResultParser = &__pyx_type_5MACS2_2IO_7cParser_ELANDResultParser;
  __pyx_vtabptr_5MACS2_2IO_7cParser_BAMParser = &__pyx_vtable_5MACS2_2IO_7cParser_BAMParser;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.tsize = (int (*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_9BAMParser_tsize;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___tsize_w_pysam = (int (*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___tsize_w_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___tsize_wo_pysam = (int (*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___tsize_wo_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.get_references = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_9BAMParser_get_references;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___get_references_w_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___get_references_w_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___get_references_wo_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___get_references_wo_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.build_fwtrack = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_9BAMParser_build_fwtrack;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___build_fwtrack_w_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___build_fwtrack_w_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___build_fwtrack_wo_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___build_fwtrack_wo_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.append_fwtrack = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_9BAMParser_append_fwtrack;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___append_fwtrack_w_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___append_fwtrack_w_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___append_fwtrack_wo_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___append_fwtrack_wo_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMParser.__pyx___fw_binary_parse = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMParser *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_9BAMParser___fw_binary_parse;
  __pyx_type_5MACS2_2IO_7cParser_BAMParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_BAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5MACS2_2IO_7cParser_BAMParser, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5MACS2_2IO_7cParser_9BAMParser___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5MACS2_2IO_7cParser_9BAMParser___init__.doc = __pyx_doc_5MACS2_2IO_7cParser_9BAMParser___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5MACS2_2IO_7cParser_9BAMParser___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_5MACS2_2IO_7cParser_BAMParser.tp_dict, __pyx_vtabptr_5MACS2_2IO_7cParser_BAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BAMParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_BAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_BAMParser = &__pyx_type_5MACS2_2IO_7cParser_BAMParser;
  __pyx_vtabptr_5MACS2_2IO_7cParser_BAMPEParser = &__pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.__pyx_base = *__pyx_vtabptr_5MACS2_2IO_7cParser_BAMParser;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.build_petrack = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser_build_petrack;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.__pyx___build_petrack_w_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *))__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___build_petrack_w_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.__pyx___build_petrack_wo_pysam = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *))__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___build_petrack_wo_pysam;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.append_petrack = (PyObject *(*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser_append_petrack;
  __pyx_vtable_5MACS2_2IO_7cParser_BAMPEParser.__pyx___pe_binary_parse = (struct __pyx_t_5MACS2_2IO_7cParser__BAMPEParsed (*)(struct __pyx_obj_5MACS2_2IO_7cParser_BAMPEParser *, char *))__pyx_f_5MACS2_2IO_7cParser_11BAMPEParser___pe_binary_parse;
  __pyx_type_5MACS2_2IO_7cParser_BAMPEParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_BAMParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_BAMPEParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5MACS2_2IO_7cParser_BAMPEParser.tp_dict, __pyx_vtabptr_5MACS2_2IO_7cParser_BAMPEParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BAMPEParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_BAMPEParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_BAMPEParser = &__pyx_type_5MACS2_2IO_7cParser_BAMPEParser;
  __pyx_type_5MACS2_2IO_7cParser_ELANDMultiParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_ELANDMultiParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ELANDMultiParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_ELANDMultiParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_ELANDMultiParser = &__pyx_type_5MACS2_2IO_7cParser_ELANDMultiParser;
  __pyx_type_5MACS2_2IO_7cParser_ELANDExportParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_ELANDExportParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ELANDExportParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_ELANDExportParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_ELANDExportParser = &__pyx_type_5MACS2_2IO_7cParser_ELANDExportParser;
  __pyx_type_5MACS2_2IO_7cParser_SAMParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_SAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SAMParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_SAMParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_SAMParser = &__pyx_type_5MACS2_2IO_7cParser_SAMParser;
  __pyx_type_5MACS2_2IO_7cParser_BowtieParser.tp_base = __pyx_ptype_5MACS2_2IO_7cParser_GenericParser;
  if (PyType_Ready(&__pyx_type_5MACS2_2IO_7cParser_BowtieParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BowtieParser", (PyObject *)&__pyx_type_5MACS2_2IO_7cParser_BowtieParser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_7cParser_BowtieParser = &__pyx_type_5MACS2_2IO_7cParser_BowtieParser;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5MACS2_2IO_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5MACS2_2IO_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5MACS2_2IO_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5MACS2_2IO_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5MACS2_2IO_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5MACS2_2IO_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "MACS2/IO/cParser.pyx":20
 * # python modules
 * # ------------------------------------
 * import logging             # <<<<<<<<<<<<<<
 * import struct
 * from struct import unpack
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":21
 * # ------------------------------------
 * import logging
 * import struct             # <<<<<<<<<<<<<<
 * from struct import unpack
 * import gzip
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":22
 * import logging
 * import struct
 * from struct import unpack             # <<<<<<<<<<<<<<
 * import gzip
 * import io
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__unpack));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__unpack));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__unpack));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__unpack, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":23
 * import struct
 * from struct import unpack
 * import gzip             # <<<<<<<<<<<<<<
 * import io
 * from MACS2.Constants import *
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__gzip, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":24
 * from struct import unpack
 * import gzip
 * import io             # <<<<<<<<<<<<<<
 * from MACS2.Constants import *
 * from MACS2.IO.cFixWidthTrack import FWTrackIII
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__io), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__io, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":25
 * import gzip
 * import io
 * from MACS2.Constants import *             # <<<<<<<<<<<<<<
 * from MACS2.IO.cFixWidthTrack import FWTrackIII
 * from MACS2.IO.cPairedEndTrack import PETrackI
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_116));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_116));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_116));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_115), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (__pyx_import_star(__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":26
 * import io
 * from MACS2.Constants import *
 * from MACS2.IO.cFixWidthTrack import FWTrackIII             # <<<<<<<<<<<<<<
 * from MACS2.IO.cPairedEndTrack import PETrackI
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__FWTrackIII));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__FWTrackIII));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FWTrackIII));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_117), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__FWTrackIII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__FWTrackIII, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":27
 * from MACS2.Constants import *
 * from MACS2.IO.cFixWidthTrack import FWTrackIII
 * from MACS2.IO.cPairedEndTrack import PETrackI             # <<<<<<<<<<<<<<
 * 
 * cdef public bint HAS_PYSAM
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PETrackI));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__PETrackI));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PETrackI));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_118), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__PETrackI); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__PETrackI, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "MACS2/IO/cParser.pyx":31
 * cdef public bint HAS_PYSAM
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import pysam
 *     HAS_PYSAM = True
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "MACS2/IO/cParser.pyx":32
 * 
 * try:
 *     import pysam             # <<<<<<<<<<<<<<
 *     HAS_PYSAM = True
 * except:
 */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__pysam), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__pysam, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "MACS2/IO/cParser.pyx":33
 * try:
 *     import pysam
 *     HAS_PYSAM = True             # <<<<<<<<<<<<<<
 * except:
 *     HAS_PYSAM = False
 */
      HAS_PYSAM = 1;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "MACS2/IO/cParser.pyx":34
 *     import pysam
 *     HAS_PYSAM = True
 * except:             # <<<<<<<<<<<<<<
 *     HAS_PYSAM = False
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("MACS2.IO.cParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_6);

      /* "MACS2/IO/cParser.pyx":35
 *     HAS_PYSAM = True
 * except:
 *     HAS_PYSAM = False             # <<<<<<<<<<<<<<
 * 
 * HAS_PYSAM=False
 */
      HAS_PYSAM = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L9_try_end:;
  }

  /* "MACS2/IO/cParser.pyx":37
 *     HAS_PYSAM = False
 * 
 * HAS_PYSAM=False             # <<<<<<<<<<<<<<
 * 
 * from cpython cimport bool
 */
  HAS_PYSAM = 0;

  /* "MACS2/IO/cParser.pyx":41
 * from cpython cimport bool
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * from numpy cimport uint32_t, uint64_t, int32_t
 */
  __pyx_t_6 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "MACS2/IO/cParser.pyx":59
 * # constants
 * # ------------------------------------
 * __version__ = "Parser $Revision$"             # <<<<<<<<<<<<<<
 * __author__ = "Tao Liu <taoliu@jimmy.harvard.edu>"
 * __doc__ = "All Parser classes"
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_119)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "MACS2/IO/cParser.pyx":60
 * # ------------------------------------
 * __version__ = "Parser $Revision$"
 * __author__ = "Tao Liu <taoliu@jimmy.harvard.edu>"             # <<<<<<<<<<<<<<
 * __doc__ = "All Parser classes"
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_120)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "MACS2/IO/cParser.pyx":61
 * __version__ = "Parser $Revision$"
 * __author__ = "Tao Liu <taoliu@jimmy.harvard.edu>"
 * __doc__ = "All Parser classes"             # <<<<<<<<<<<<<<
 * 
 * # ------------------------------------
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____doc__, ((PyObject *)__pyx_kp_s_121)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "MACS2/IO/cParser.pyx":105
 * # Classes
 * # ------------------------------------
 * class StrandFormatError( Exception ):             # <<<<<<<<<<<<<<
 *     """Exception about strand format error.
 * 
 */
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));

  /* "MACS2/IO/cParser.pyx":111
 *     raise StrandFormatError('Must be F or R','X')
 *     """
 *     def __init__ ( self, string, strand ):             # <<<<<<<<<<<<<<
 *         self.strand = strand
 *         self.string = string
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_2IO_7cParser_17StrandFormatError_1__init__, 0, __pyx_n_s_125, NULL, __pyx_n_s_126, ((PyObject *)__pyx_k_codeobj_123)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_6, __pyx_n_s____init__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":115
 *         self.string = string
 * 
 *     def __str__ ( self ):             # <<<<<<<<<<<<<<
 *         return repr( "Strand information can not be recognized in this line: \"%s\",\"%s\"" % ( self.string, self.strand ) )
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5MACS2_2IO_7cParser_17StrandFormatError_3__str__, 0, __pyx_n_s_129, NULL, __pyx_n_s_126, ((PyObject *)__pyx_k_codeobj_128)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_6, __pyx_n_s____str__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "MACS2/IO/cParser.pyx":105
 * # Classes
 * # ------------------------------------
 * class StrandFormatError( Exception ):             # <<<<<<<<<<<<<<
 *     """Exception about strand format error.
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_6), "__doc__", ((PyObject *)__pyx_kp_s_130)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6), __pyx_n_s__StrandFormatError, __pyx_n_s__StrandFormatError, __pyx_n_s_126); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__StrandFormatError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

  /* "MACS2/IO/cParser.pyx":1
 * # Time-stamp: <2013-04-09 15:50:11 Tao Liu>             # <<<<<<<<<<<<<<
 * 
 * """Module for all MACS Parser classes for input.
 */
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

  /* "numpy.pxd":977
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    __Pyx_AddTraceback("init MACS2.IO.cParser", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init MACS2.IO.cParser");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
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;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
        if (PyInstance_Check(type)) {
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        } else {
            type = 0;
            PyErr_SetString(PyExc_TypeError,
                "raise: exception must be an old-style class or instance");
            goto raise_error;
        }
        #else
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        } else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

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)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (DECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
    int q = a / b;
    int r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        #if CYTHON_PEP393_ENABLED
        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
            return -1;
        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #else
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #endif
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

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;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (PyErr_ExceptionMatches(PyExc_OverflowError))
                    PyErr_Clear();
                else
                    goto bad;
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_COMPILING_IN_CPYTHON
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    PyObject* dict = PyModule_GetDict(__pyx_m);
    Py_XINCREF(dict);
    return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
    0,                                  /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
        return -1;
    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *qualname, PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;
    if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
        return NULL;
    if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
        return NULL;
    metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
     return *s1 == *s2;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (r < 0) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
