/* Generated by Cython 0.15.1 on Tue Apr 23 14:21:24 2013 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_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
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#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__HTSeq___HTSeq
#define __PYX_HAVE_API__HTSeq___HTSeq
#include "stdio.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


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_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*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif

#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif

static const char *__pyx_f[] = {
  "_HTSeq.pyx",
  "_HTSeq.pxd",
  "numpy.pxd",
};

/* "numpy.pxd":719
 * # 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_5numpy_int8_t;

/* "numpy.pxd":720
 * 
 * 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_5numpy_int16_t;

/* "numpy.pxd":721
 * 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_5numpy_int32_t;

/* "numpy.pxd":722
 * 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_5numpy_int64_t;

/* "numpy.pxd":726
 * #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_5numpy_uint8_t;

/* "numpy.pxd":727
 * 
 * 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_5numpy_uint16_t;

/* "numpy.pxd":728
 * 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_5numpy_uint32_t;

/* "numpy.pxd":729
 * 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_5numpy_uint64_t;

/* "numpy.pxd":733
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "numpy.pxd":734
 * 
 * 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_5numpy_float64_t;

/* "numpy.pxd":743
 * # 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_5numpy_int_t;

/* "numpy.pxd":744
 * # 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_5numpy_long_t;

/* "numpy.pxd":745
 * 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_5numpy_longlong_t;

/* "numpy.pxd":747
 * 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_5numpy_uint_t;

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

/* "numpy.pxd":749
 * 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_5numpy_ulonglong_t;

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

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

/* "numpy.pxd":754
 * 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_5numpy_float_t;

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

/* "numpy.pxd":756
 * 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_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_5HTSeq_6_HTSeq_Alignment;
struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal;
struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment;
struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation;
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval;
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition;
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray;
struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__;
struct __pyx_obj_5HTSeq_6_HTSeq_Sequence;
struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities;
struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment;
struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector;

/* "numpy.pxd":758
 * 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_5numpy_cfloat_t;

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

/* "numpy.pxd":760
 * 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_5numpy_clongdouble_t;

/* "numpy.pxd":762
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end;
struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end;
struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals;
struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals;
struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar;
struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list;

/* "HTSeq/_HTSeq.pxd":25
 *    cpdef Sequence get_reverse_complement( self )
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ )
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = ? )             # <<<<<<<<<<<<<<
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = ? )
 * 
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end {
  int __pyx_n;
  float mismatch_prop;
};

/* "HTSeq/_HTSeq.pxd":26
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ )
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = ? )
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = ? )             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end {
  int __pyx_n;
  float mismatch_prop;
};

/* "HTSeq/_HTSeq.pxd":36
 *    cdef _fill_qual_arr( SequenceWithQualities self )
 *    cpdef object add_qual_to_count_array( SequenceWithQualities self, numpy.ndarray count_array_ )
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          Sequence pattern, int max_mm_qual = ? )
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals {
  int __pyx_n;
  int max_mm_qual;
};

/* "HTSeq/_HTSeq.pxd":38
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,
 *          Sequence pattern, int max_mm_qual = ? )
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          Sequence pattern, int max_mm_qual = ? )
 * 
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals {
  int __pyx_n;
  int max_mm_qual;
};

/* "HTSeq/_HTSeq.pyx":1110
 * _re_cigar_codes = re.compile( '([A-Z])' )
 * 
 * cpdef list parse_cigar( str cigar_string, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, cl
 *    cdef int size
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar {
  int __pyx_n;
  int ref_left;
  PyObject *chrom;
  PyObject *strand;
};

/* "HTSeq/_HTSeq.pyx":1127
 *    return build_cigar_list( cl, ref_left, chrom, strand  )
 * 
 * cpdef list build_cigar_list( list cigar_pairs, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, res
 *    cdef int rpos, qpos, size
 */
struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list {
  int __pyx_n;
  int ref_left;
  PyObject *chrom;
  PyObject *strand;
};

/* "HTSeq/_HTSeq.pxd":42
 * 
 * 
 * cdef class Alignment( object ):             # <<<<<<<<<<<<<<
 *    cdef public SequenceWithQualities _read
 *    cdef public GenomicInterval iv
 */
struct __pyx_obj_5HTSeq_6_HTSeq_Alignment {
  PyObject_HEAD
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *_read;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *iv;
};


/* "HTSeq/_HTSeq.pxd":46
 *    cdef public GenomicInterval iv
 * 
 * cdef class AlignmentWithSequenceReversal( Alignment ):             # <<<<<<<<<<<<<<
 *    cdef public SequenceWithQualities read_as_aligned
 *    cdef public SequenceWithQualities _read_as_sequenced
 */
struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal {
  struct __pyx_obj_5HTSeq_6_HTSeq_Alignment __pyx_base;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *read_as_aligned;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *_read_as_sequenced;
};


/* "HTSeq/_HTSeq.pyx":1034
 * 
 * 
 * cdef class BowtieAlignment( AlignmentWithSequenceReversal ):             # <<<<<<<<<<<<<<
 * 
 *    """When reading in a Bowtie file, objects of the class BowtieAlignment
 */
struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment {
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal __pyx_base;
  PyObject *reserved;
  PyObject *substitutions;
};


/* "HTSeq/_HTSeq.pyx":1067
 *    'P': 'padded' }
 * 
 * cdef class CigarOperation( object ):             # <<<<<<<<<<<<<<
 * 
 *    cdef public str type
 */
struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation {
  PyObject_HEAD
  PyObject *type;
  int size;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *ref_iv;
  int query_from;
  int query_to;
};


/* "HTSeq/_HTSeq.pxd":3
 * cimport numpy
 * 
 * cdef class GenomicInterval:             # <<<<<<<<<<<<<<
 * 
 *    cdef public str chrom
 */
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval {
  PyObject_HEAD
  struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *__pyx_vtab;
  PyObject *chrom;
  long start;
  long end;
  PyObject *_strand;
};


/* "HTSeq/_HTSeq.pxd":15
 *    cpdef extend_to_include( GenomicInterval self, GenomicInterval iv )
 * 
 * cdef class GenomicPosition( GenomicInterval ):             # <<<<<<<<<<<<<<
 *    pass
 * 
 */
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval __pyx_base;
};


/* "HTSeq/_HTSeq.pyx":478
 *    return cv
 * 
 * cdef class GenomicArray( object ):             # <<<<<<<<<<<<<<
 * 
 *    cdef public dict chrom_vectors
 */
struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray {
  PyObject_HEAD
  PyObject *chrom_vectors;
  int stranded;
  PyObject *typecode;
  int auto_add_chroms;
  PyObject *storage;
  PyObject *memmap_dir;
};


/* "HTSeq/_HTSeq.pyx":437
 *          raise TypeError, "Illegal index type"
 * 
 *    def __iadd__( self, value ):             # <<<<<<<<<<<<<<
 *       if not self.is_vector_of_sets:
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )
 */
struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ {
  PyObject_HEAD
  PyObject *__pyx_v_value;
};


/* "HTSeq/_HTSeq.pxd":19
 * 
 * 
 * cdef class Sequence( object ):             # <<<<<<<<<<<<<<
 *    cdef public bytes seq
 *    cdef public str name
 */
struct __pyx_obj_5HTSeq_6_HTSeq_Sequence {
  PyObject_HEAD
  struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *__pyx_vtab;
  PyObject *seq;
  PyObject *name;
  PyObject *descr;
};


/* "HTSeq/_HTSeq.pxd":29
 * 
 * 
 * cdef class SequenceWithQualities( Sequence ):             # <<<<<<<<<<<<<<
 *    cdef readonly bytes _qualstr
 *    cdef readonly bytes _qualstr_phred
 */
struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence __pyx_base;
  PyObject *_qualstr;
  PyObject *_qualstr_phred;
  PyObject *_qualscale;
  PyObject *_qualarr;
};


/* "HTSeq/_HTSeq.pxd":50
 *    cdef public SequenceWithQualities _read_as_sequenced
 * 
 * cdef class SAM_Alignment( AlignmentWithSequenceReversal ):             # <<<<<<<<<<<<<<
 *    cdef public list cigar
 *    cdef public int aQual
 */
struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment {
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal __pyx_base;
  PyObject *cigar;
  int aQual;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *mate_start;
  PyObject *pe_which;
  int inferred_insert_size;
  int proper_pair;
  int not_primary_alignment;
  int failed_platform_qc;
  int pcr_or_optical_duplicate;
  PyObject *original_sam_line;
  int _flag;
  PyObject *optional_fields;
};


/* "HTSeq/_HTSeq.pyx":314
 * 
 * 
 * cdef class ChromVector( object ):             # <<<<<<<<<<<<<<
 * 
 *    cdef public object array
 */
struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector {
  PyObject_HEAD
  PyObject *array;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *iv;
  int offset;
  int is_vector_of_sets;
  PyObject *_storage;
};



/* "HTSeq/_HTSeq.pyx":26
 * cdef str strand_nostrand = intern( "." )
 * 
 * cdef class GenomicInterval:             # <<<<<<<<<<<<<<
 * 
 *    """A GenomicInterval specifies an interval (i.e., a range of
 */

struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval {
  PyObject *(*is_contained_in)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch);
  PyObject *(*contains)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch);
  PyObject *(*overlaps)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch);
  PyObject *(*extend_to_include)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *__pyx_vtabptr_5HTSeq_6_HTSeq_GenomicInterval;


/* "HTSeq/_HTSeq.pyx":634
 * base_to_column = { 'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4 }
 * 
 * cdef class Sequence( object ):             # <<<<<<<<<<<<<<
 *    """A Sequence, typically of DNA, with a name.
 *    """
 */

struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*get_reverse_complement)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch);
  PyObject *(*add_bases_to_count_array)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, PyArrayObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*trim_left_end)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end *__pyx_optional_args);
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*trim_right_end)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end *__pyx_optional_args);
};
static struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *__pyx_vtabptr_5HTSeq_6_HTSeq_Sequence;


/* "HTSeq/_HTSeq.pyx":754
 * 
 * 
 * cdef class SequenceWithQualities( Sequence ):             # <<<<<<<<<<<<<<
 *    """A Sequence with base-call quality scores.
 *    It now has property  'qual', an integer NumPy array of Sanger/Phred
 */

struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities {
  struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence __pyx_base;
  PyObject *(*_fill_qual_arr)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *);
  PyObject *(*add_qual_to_count_array)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, PyArrayObject *, int __pyx_skip_dispatch);
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*trim_left_end_with_quals)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals *__pyx_optional_args);
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*trim_right_end_with_quals)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals *__pyx_optional_args);
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*get_reverse_complement)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_vtabptr_5HTSeq_6_HTSeq_SequenceWithQualities;


/* "HTSeq/_HTSeq.pyx":257
 * 
 * 
 * cdef class GenomicPosition( GenomicInterval ):             # <<<<<<<<<<<<<<
 * 
 *    """A GenomicPosition specifies the position of a nucleotide or
 */

struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicPosition {
  struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval __pyx_base;
};
static struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicPosition *__pyx_vtabptr_5HTSeq_6_HTSeq_GenomicPosition;

#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;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_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)
  #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 */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*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 CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

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

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
    return unlikely(b < 0) ? b : !b; 
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction);

static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                   Py_ssize_t end, int direction);

static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction);

/* Run-time type information about structs used with buffers */
struct __Pyx_StructField_;

typedef struct {
  const char* name; /* for error messages only */
  struct __Pyx_StructField_* fields;
  size_t size;     /* sizeof(type) */
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
} __Pyx_TypeInfo;

typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;

typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;


static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/
#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)

static void __Pyx_RaiseBufferFallbackError(void); /*proto*/

static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */

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

static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */

#define __Pyx_PyObject_AsDouble(obj) \
    ((likely(PyFloat_CheckExact(obj))) ? \
     PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif

Py_ssize_t __Pyx_zeros[] = {0, 0};
Py_ssize_t __Pyx_minusones[] = {-1, -1};

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

static PyObject* __Pyx_Intern(PyObject* s); /* proto */

#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*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_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

static PyTypeObject __pyx_binding_PyCFunctionType_type;
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)

static int __pyx_binding_PyCFunctionType_init(void); /* proto */

static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject *);

static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */

static CYTHON_INLINE npy_long __Pyx_PyInt_from_py_npy_long(PyObject *);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t);

#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 int __Pyx_check_binary_version(void);

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

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

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

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

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

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

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

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

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

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

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/

/* Module declarations from 'HTSeq._HTSeq' */
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_Sequence = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_Alignment = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_ChromVector = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_GenomicArray = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_BowtieAlignment = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation = 0;
static PyTypeObject *__pyx_ptype_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ = 0;
static PyObject *__pyx_v_5HTSeq_6_HTSeq_strand_plus = 0;
static PyObject *__pyx_v_5HTSeq_6_HTSeq_strand_minus = 0;
static PyObject *__pyx_v_5HTSeq_6_HTSeq_strand_nostrand = 0;
static PyObject *__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation = 0;
static PyObject *__pyx_f_5HTSeq_6_HTSeq_reverse_complement(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_parse_cigar(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_build_cigar_list(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq__parse_SAM_optional_field_value(PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' };
#define __Pyx_MODULE_NAME "HTSeq._HTSeq"
int __pyx_module_is_main_HTSeq___HTSeq = 0;

/* Implementation of 'HTSeq._HTSeq' */
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_chr;
static PyObject *__pyx_builtin_ord;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_RuntimeError;
static char __pyx_k_2[] = "start is larger than end";
static char __pyx_k_3[] = "Strand must be'+', '-', or '.'.";
static char __pyx_k_4[] = "<%s object '%s', [%d,%s), strand '%s'>";
static char __pyx_k_5[] = "%s:[%d,%s)/%s";
static char __pyx_k_6[] = "GenomicInterval_xrange";
static char __pyx_k_7[] = "GenomicInterval_xranged";
static char __pyx_k_8[] = "Cannot extend an interval to include None.";
static char __pyx_k_9[] = "Cannot extend an interval to include an interval on another chromosome.";
static char __pyx_k_10[] = "Cannot extend an interval to include an interval on another strand.";
static char __pyx_k_11[] = ".";
static char __pyx_k_12[] = "<%s object '%s':%d, strand '%s'>";
static char __pyx_k_13[] = "%s:%d/%s";
static char __pyx_k_14[] = "";
static char __pyx_k_15[] = ".nmm";
static char __pyx_k_16[] = "w+";
static char __pyx_k_17[] = "Illegal storage mode.";
static char __pyx_k_18[] = "Cannot subset to zero-length interval.";
static char __pyx_k_19[] = "start too small";
static char __pyx_k_20[] = "stop too large";
static char __pyx_k_21[] = "Illegal index type";
static char __pyx_k_22[] = "Required assignment signature not yet implemented.";
static char __pyx_k_23[] = "Start of interval is after its end.";
static char __pyx_k_24[] = "Cannot assign to zero-length interval.";
static char __pyx_k_25[] = "Chromosome name mismatch.";
static char __pyx_k_26[] = "Strand mismatch.";
static char __pyx_k_27[] = "HTSeq._HTSeq";
static char __pyx_k_28[] = "<%s object, %s, %s>";
static char __pyx_k_29[] = "_ChromVector_unpickle";
static char __pyx_k_30[] = "Automatic adding of chromosomes can ";
static char __pyx_k_31[] = " only be used with storage type 'StepVector'.";
static char __pyx_k_32[] = "Indefinite-length chromosomes can ";
static char __pyx_k_33[] = "'chroms' must be a list or a dict or 'auto'.";
static char __pyx_k_34[] = "Non-stranded index used for stranded GenomicArray.";
static char __pyx_k_35[] = "Illegal index type.";
static char __pyx_k_37[] = "+";
static char __pyx_k_38[] = "-";
static char __pyx_k_39[] = "_GenomicArray_unpickle";
static char __pyx_k_40[] = "Strand specified in unstranded GenomicArray.";
static char __pyx_k_41[] = "Strand must be specified for stranded GenomicArray.";
static char __pyx_k_42[] = "track type=bedGraph\n";
static char __pyx_k_44[] = "track type=bedGraph %s\n";
static char __pyx_k_45[] = "%s\t%d\t%d\t%f\n";
static char __pyx_k_47[] = "get_reverse_complement";
static char __pyx_k_48[] = "<%s object '%s' (length %d)>";
static char __pyx_k_49[] = "[part]";
static char __pyx_k_50[] = ">%s %s\n";
static char __pyx_k_51[] = ">%s\n";
static char __pyx_k_52[] = "\n";
static char __pyx_k_53[] = "add_bases_to_count_array";
static char __pyx_k_54[] = "'count_array' too small for sequence.";
static char __pyx_k_55[] = "'count_array' has too few columns.";
static char __pyx_k_56[] = "Illegal base letter encountered.";
static char __pyx_k_57[] = "'seq' and 'qualstr' do not have the same length.";
static char __pyx_k_58[] = "Quality string missing.";
static char __pyx_k_59[] = "Quality string has not the same length as sequence.";
static char __pyx_k_60[] = "solexa-old";
static char __pyx_k_61[] = "Illegal quality scale '%s'.";
static char __pyx_k_62[] = "qual can only be assigned a numpy array of type numpy.int";
static char __pyx_k_63[] = "assignment to qual with illegal shape";
static char __pyx_k_64[] = "<%s object '%s'>";
static char __pyx_k_65[] = "Quality string missing";
static char __pyx_k_66[] = " ";
static char __pyx_k_67[] = "@%s %s\n";
static char __pyx_k_68[] = "@%s\n";
static char __pyx_k_69[] = "+\n";
static char __pyx_k_73[] = "add_qual_to_count_array";
static char __pyx_k_74[] = "Too large quality value encountered.";
static char __pyx_k_75[] = "trim_left_end_with_quals";
static char __pyx_k_76[] = "trim_right_end_with_quals";
static char __pyx_k_77[] = "Paired-end read";
static char __pyx_k_78[] = "<%s object: %s '%s' aligned to %s>";
static char __pyx_k_79[] = "<%s object: %s '%s', not aligned>";
static char __pyx_k_80[] = "\t";
static char __pyx_k_82[] = "Inconsistent CIGAR operation.";
static char __pyx_k_83[] = "< %s: %d base(s) %s on ref iv %s, query iv [%d,%d) >";
static char __pyx_k_84[] = "cigar_operation_names";
static char __pyx_k_85[] = "Illegal CIGAR string '%s'";
static char __pyx_k_86[] = "Unknown CIGAR code '%s' encountered.";
static char __pyx_k_87[] = ":";
static char __pyx_k_88[] = "Malformatted SAM optional field '%'";
static char __pyx_k_89[] = "SAM optional field with illegal type letter '%s'";
static char __pyx_k_90[] = "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)";
static char __pyx_k_92[] = "cigar_operation_code_dict";
static char __pyx_k_93[] = "*";
static char __pyx_k_94[] = "cigar_operation_codes";
static char __pyx_k_96[] = "SAM line does not contain at least 11 tab-delimited fields.";
static char __pyx_k_97[] = "=";
static char __pyx_k_99[] = "Sequence in SAM file contains '=', which is not supported.";
static char __pyx_k__A[] = "A";
static char __pyx_k__B[] = "B";
static char __pyx_k__C[] = "C";
static char __pyx_k__D[] = "D";
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__M[] = "M";
static char __pyx_k__N[] = "N";
static char __pyx_k__O[] = "O";
static char __pyx_k__P[] = "P";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__S[] = "S";
static char __pyx_k__T[] = "T";
static char __pyx_k__X[] = "X";
static char __pyx_k__Z[] = "Z";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__c[] = "c";
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__j[] = "j";
static char __pyx_k__l[] = "l";
static char __pyx_k__q[] = "q";
static char __pyx_k__t[] = "t";
static char __pyx_k__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k_101[] = "Sequence in SAM file contains '.', which is not supported.";
static char __pyx_k_102[] = "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set";
static char __pyx_k_104[] = "Malformed SAM line: RNAME == '*' although flag bit &0x0004 cleared";
static char __pyx_k_105[] = "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set";
static char __pyx_k_107[] = "Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared";
static char __pyx_k_108[] = "Malformed SAM line: MRNM == '=' although read is not aligned.";
static char __pyx_k_112[] = "SAM optional field tag %s not found";
static char __pyx_k_113[] = "SAM optional field tag %s not unique";
static char __pyx_k_114[] = "ndarray is not C contiguous";
static char __pyx_k_116[] = "ndarray is not Fortran contiguous";
static char __pyx_k_118[] = "Non-native byte order not supported";
static char __pyx_k_120[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_121[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_124[] = "Format string allocated too short.";
static char __pyx_k_126[] = "The length is calculated as end - start. If you set the length, \n      'start_d' will be preserved, i.e., 'end' is changed, unless the strand\n      is '-', in which case 'start' is changed.";
static char __pyx_k_127[] = "See the class docstring for the meaning of the 'directional start'.\n      Note that if you set 'start_d', both the start and the end are changed, \n      such the interval gets the requested new directional start and its\n      length stays unchanged.";
static char __pyx_k_128[] = "As GenomicPosition is a subclass of GenomicInterval, 'pos' is actually\n      just an alias for 'start_d'.\n      ";
static char __pyx_k_129[] = "GenomicInterval_from_directional";
static char __pyx_k_130[] = "_make_translation_table_for_complementation";
static char __pyx_k_131[] = "soft-clipped";
static char __pyx_k_132[] = "hard-clipped";
static char __pyx_k_133[] = "([A-Z])";
static char __pyx_k_135[] = "from_pysam_AlignedRead";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__iv[] = "iv";
static char __pyx_k__os[] = "os";
static char __pyx_k__re[] = "re";
static char __pyx_k__se[] = "se";
static char __pyx_k__Inf[] = "Inf";
static char __pyx_k__add[] = "add";
static char __pyx_k__chr[] = "chr";
static char __pyx_k__csv[] = "csv";
static char __pyx_k__end[] = "end";
static char __pyx_k__int[] = "int";
static char __pyx_k__ord[] = "ord";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__qto[] = "qto";
static char __pyx_k__rto[] = "rto";
static char __pyx_k__seq[] = "seq";
static char __pyx_k__sys[] = "sys";
static char __pyx_k__tid[] = "tid";
static char __pyx_k__vec[] = "vec";
static char __pyx_k__Read[] = "Read";
static char __pyx_k__aend[] = "aend";
static char __pyx_k__auto[] = "auto";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__flag[] = "flag";
static char __pyx_k__gzip[] = "gzip";
static char __pyx_k__join[] = "join";
static char __pyx_k__mapq[] = "mapq";
static char __pyx_k__math[] = "math";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__mpos[] = "mpos";
static char __pyx_k__mrnm[] = "mrnm";
static char __pyx_k__name[] = "name";
static char __pyx_k__none[] = "none";
static char __pyx_k__open[] = "open";
static char __pyx_k__path[] = "path";
static char __pyx_k__qual[] = "qual";
static char __pyx_k__read[] = "read";
static char __pyx_k__size[] = "size";
static char __pyx_k__step[] = "step";
static char __pyx_k__stop[] = "stop";
static char __pyx_k__tags[] = "tags";
static char __pyx_k__type[] = "type";
static char __pyx_k__warn[] = "warn";
static char __pyx_k__apply[] = "apply";
static char __pyx_k__array[] = "array";
static char __pyx_k__check[] = "check";
static char __pyx_k__chrom[] = "chrom";
static char __pyx_k__cigar[] = "cigar";
static char __pyx_k__close[] = "close";
static char __pyx_k__count[] = "count";
static char __pyx_k__descr[] = "descr";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__end_d[] = "end_d";
static char __pyx_k__first[] = "first";
static char __pyx_k__index[] = "index";
static char __pyx_k__isize[] = "isize";
static char __pyx_k__log10[] = "log10";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__phred[] = "phred";
static char __pyx_k__pysam[] = "pysam";
static char __pyx_k__qfrom[] = "qfrom";
static char __pyx_k__qname[] = "qname";
static char __pyx_k__range[] = "range";
static char __pyx_k__rfrom[] = "rfrom";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__split[] = "split";
static char __pyx_k__start[] = "start";
static char __pyx_k__steps[] = "steps";
static char __pyx_k__type_[] = "type_";
static char __pyx_k__upper[] = "upper";
static char __pyx_k__write[] = "write";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k__chroms[] = "chroms";
static char __pyx_k__create[] = "create";
static char __pyx_k__gettid[] = "gettid";
static char __pyx_k__length[] = "length";
static char __pyx_k__maxint[] = "maxint";
static char __pyx_k__memmap[] = "memmap";
static char __pyx_k__offset[] = "offset";
static char __pyx_k__padded[] = "padded";
static char __pyx_k__ref_iv[] = "ref_iv";
static char __pyx_k__rstrip[] = "rstrip";
static char __pyx_k__second[] = "second";
static char __pyx_k__solexa[] = "solexa";
static char __pyx_k__stderr[] = "stderr";
static char __pyx_k__strand[] = "strand";
static char __pyx_k__values[] = "values";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__aligned[] = "aligned";
static char __pyx_k__compile[] = "compile";
static char __pyx_k__deleted[] = "deleted";
static char __pyx_k__matched[] = "matched";
static char __pyx_k__missing[] = "missing";
static char __pyx_k__ndarray[] = "ndarray";
static char __pyx_k__noquals[] = "noquals";
static char __pyx_k__pattern[] = "pattern";
static char __pyx_k__qualstr[] = "qualstr";
static char __pyx_k__samfile[] = "samfile";
static char __pyx_k__skipped[] = "skipped";
static char __pyx_k__start_d[] = "start_d";
static char __pyx_k__storage[] = "storage";
static char __pyx_k__unknown[] = "unknown";
static char __pyx_k__unnamed[] = "unnamed";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k__StringIO[] = "StringIO";
static char __pyx_k____iadd__[] = "__iadd__";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k___qualarr[] = "_qualarr";
static char __pyx_k___qualstr[] = "_qualstr";
static char __pyx_k___storage[] = "_storage";
static char __pyx_k__contains[] = "contains";
static char __pyx_k__filename[] = "filename";
static char __pyx_k__getrname[] = "getrname";
static char __pyx_k__getvalue[] = "getvalue";
static char __pyx_k__inserted[] = "inserted";
static char __pyx_k__is_read1[] = "is_read1";
static char __pyx_k__is_read2[] = "is_read2";
static char __pyx_k__overlaps[] = "overlaps";
static char __pyx_k__property[] = "property";
static char __pyx_k__ref_left[] = "ref_left";
static char __pyx_k__stranded[] = "stranded";
static char __pyx_k__typecode[] = "typecode";
static char __pyx_k__warnings[] = "warnings";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__add_chrom[] = "add_chrom";
static char __pyx_k__cStringIO[] = "cStringIO";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__is_paired[] = "is_paired";
static char __pyx_k__is_qcfail[] = "is_qcfail";
static char __pyx_k__itertools[] = "itertools";
static char __pyx_k__qualscale[] = "qualscale";
static char __pyx_k__translate[] = "translate";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__StepVector[] = "StepVector";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k____reduce__[] = "__reduce__";
static char __pyx_k___qualscale[] = "_qualscale";
static char __pyx_k__is_reverse[] = "is_reverse";
static char __pyx_k__memmap_dir[] = "memmap_dir";
static char __pyx_k__paired_end[] = "paired_end";
static char __pyx_k__AlignedRead[] = "AlignedRead";
static char __pyx_k__ImportError[] = "ImportError";
static char __pyx_k__bowtie_line[] = "bowtie_line";
static char __pyx_k__cigar_pairs[] = "cigar_pairs";
static char __pyx_k__collections[] = "collections";
static char __pyx_k__is_unmapped[] = "is_unmapped";
static char __pyx_k__max_mm_qual[] = "max_mm_qual";
static char __pyx_k__revcomp_of_[] = "revcomp_of_";
static char __pyx_k__start_index[] = "start_index";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k___create_view[] = "_create_view";
static char __pyx_k__cigar_string[] = "cigar_string";
static char __pyx_k__is_duplicate[] = "is_duplicate";
static char __pyx_k__is_secondary[] = "is_secondary";
static char __pyx_k__mate_aligned[] = "mate_aligned";
static char __pyx_k__chrom_vectors[] = "chrom_vectors";
static char __pyx_k__from_SAM_line[] = "from_SAM_line";
static char __pyx_k__mismatch_prop[] = "mismatch_prop";
static char __pyx_k__track_options[] = "track_options";
static char __pyx_k__trim_left_end[] = "trim_left_end";
static char __pyx_k__base_to_column[] = "base_to_column";
static char __pyx_k__is_proper_pair[] = "is_proper_pair";
static char __pyx_k__not_paired_end[] = "not_paired_end";
static char __pyx_k__trim_right_end[] = "trim_right_end";
static char __pyx_k___HTSeq_internal[] = "_HTSeq_internal";
static char __pyx_k___re_cigar_codes[] = "_re_cigar_codes";
static char __pyx_k__is_contained_in[] = "is_contained_in";
static char __pyx_k__mate_is_reverse[] = "mate_is_reverse";
static char __pyx_k__read_as_aligned[] = "read_as_aligned";
static char __pyx_k__convert_to_phred[] = "convert_to_phred";
static char __pyx_k__file_or_filename[] = "file_or_filename";
static char __pyx_k__ChromVector_steps[] = "ChromVector_steps";
static char __pyx_k__extend_to_include[] = "extend_to_include";
static char __pyx_k__is_vector_of_sets[] = "is_vector_of_sets";
static char __pyx_k__GenomicArray_steps[] = "GenomicArray_steps";
static char __pyx_k__NotImplementedError[] = "NotImplementedError";
static char __pyx_k__raw_optional_fields[] = "raw_optional_fields";
static char __pyx_k__write_to_fastq_file[] = "write_to_fastq_file";
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_101;
static PyObject *__pyx_kp_s_102;
static PyObject *__pyx_kp_s_104;
static PyObject *__pyx_kp_s_105;
static PyObject *__pyx_kp_s_107;
static PyObject *__pyx_kp_s_108;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_112;
static PyObject *__pyx_kp_s_113;
static PyObject *__pyx_kp_u_114;
static PyObject *__pyx_kp_u_116;
static PyObject *__pyx_kp_u_118;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_u_120;
static PyObject *__pyx_kp_u_121;
static PyObject *__pyx_kp_u_124;
static PyObject *__pyx_n_s_129;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_n_s_130;
static PyObject *__pyx_kp_s_131;
static PyObject *__pyx_kp_s_132;
static PyObject *__pyx_kp_s_133;
static PyObject *__pyx_n_s_135;
static PyObject *__pyx_kp_b_14;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_n_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_n_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_n_s_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_n_s_47;
static PyObject *__pyx_kp_s_48;
static PyObject *__pyx_kp_s_49;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_50;
static PyObject *__pyx_kp_s_51;
static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_kp_s_55;
static PyObject *__pyx_kp_s_56;
static PyObject *__pyx_kp_s_57;
static PyObject *__pyx_kp_s_58;
static PyObject *__pyx_kp_s_59;
static PyObject *__pyx_n_s_6;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_kp_s_63;
static PyObject *__pyx_kp_s_64;
static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_kp_s_66;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s_68;
static PyObject *__pyx_kp_s_69;
static PyObject *__pyx_n_s_7;
static PyObject *__pyx_n_s_73;
static PyObject *__pyx_kp_s_74;
static PyObject *__pyx_n_s_75;
static PyObject *__pyx_n_s_76;
static PyObject *__pyx_kp_s_77;
static PyObject *__pyx_kp_s_78;
static PyObject *__pyx_kp_s_79;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_80;
static PyObject *__pyx_kp_s_82;
static PyObject *__pyx_kp_s_83;
static PyObject *__pyx_n_s_84;
static PyObject *__pyx_kp_s_85;
static PyObject *__pyx_kp_s_86;
static PyObject *__pyx_kp_s_87;
static PyObject *__pyx_kp_s_88;
static PyObject *__pyx_kp_s_89;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_kp_s_90;
static PyObject *__pyx_n_s_92;
static PyObject *__pyx_kp_s_93;
static PyObject *__pyx_n_s_94;
static PyObject *__pyx_kp_s_96;
static PyObject *__pyx_kp_s_97;
static PyObject *__pyx_kp_s_99;
static PyObject *__pyx_n_s__A;
static PyObject *__pyx_n_s__AlignedRead;
static PyObject *__pyx_n_s__C;
static PyObject *__pyx_n_s__ChromVector_steps;
static PyObject *__pyx_n_s__D;
static PyObject *__pyx_n_s__G;
static PyObject *__pyx_n_s__GenomicArray_steps;
static PyObject *__pyx_n_s__H;
static PyObject *__pyx_n_s__I;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__Inf;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__M;
static PyObject *__pyx_n_s__N;
static PyObject *__pyx_n_s__NotImplementedError;
static PyObject *__pyx_n_s__O;
static PyObject *__pyx_n_s__P;
static PyObject *__pyx_n_s__Read;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__S;
static PyObject *__pyx_n_s__StepVector;
static PyObject *__pyx_n_s__StringIO;
static PyObject *__pyx_n_s__T;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s__X;
static PyObject *__pyx_n_s__Z;
static PyObject *__pyx_n_s___HTSeq_internal;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____iadd__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____reduce__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___create_view;
static PyObject *__pyx_n_s___qualarr;
static PyObject *__pyx_n_s___qualscale;
static PyObject *__pyx_n_s___qualstr;
static PyObject *__pyx_n_s___re_cigar_codes;
static PyObject *__pyx_n_s___storage;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__add_chrom;
static PyObject *__pyx_n_s__aend;
static PyObject *__pyx_n_s__aligned;
static PyObject *__pyx_n_s__apply;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__auto;
static PyObject *__pyx_n_s__base_to_column;
static PyObject *__pyx_n_s__bowtie_line;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_s__cStringIO;
static PyObject *__pyx_n_s__check;
static PyObject *__pyx_n_s__chr;
static PyObject *__pyx_n_s__chrom;
static PyObject *__pyx_n_s__chrom_vectors;
static PyObject *__pyx_n_s__chroms;
static PyObject *__pyx_n_s__cigar;
static PyObject *__pyx_n_s__cigar_pairs;
static PyObject *__pyx_n_s__cigar_string;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__collections;
static PyObject *__pyx_n_s__compile;
static PyObject *__pyx_n_s__contains;
static PyObject *__pyx_n_s__convert_to_phred;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__count;
static PyObject *__pyx_n_s__create;
static PyObject *__pyx_n_s__csv;
static PyObject *__pyx_n_s__d;
static PyObject *__pyx_n_s__deleted;
static PyObject *__pyx_n_s__descr;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__end;
static PyObject *__pyx_n_s__end_d;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__extend_to_include;
static PyObject *__pyx_n_s__f;
static PyObject *__pyx_n_s__file_or_filename;
static PyObject *__pyx_n_s__filename;
static PyObject *__pyx_n_s__first;
static PyObject *__pyx_n_s__flag;
static PyObject *__pyx_n_s__from_SAM_line;
static PyObject *__pyx_n_s__g;
static PyObject *__pyx_n_s__getrname;
static PyObject *__pyx_n_s__gettid;
static PyObject *__pyx_n_s__getvalue;
static PyObject *__pyx_n_s__gzip;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__index;
static PyObject *__pyx_n_s__inserted;
static PyObject *__pyx_n_s__int;
static PyObject *__pyx_n_s__is_contained_in;
static PyObject *__pyx_n_s__is_duplicate;
static PyObject *__pyx_n_s__is_paired;
static PyObject *__pyx_n_s__is_proper_pair;
static PyObject *__pyx_n_s__is_qcfail;
static PyObject *__pyx_n_s__is_read1;
static PyObject *__pyx_n_s__is_read2;
static PyObject *__pyx_n_s__is_reverse;
static PyObject *__pyx_n_s__is_secondary;
static PyObject *__pyx_n_s__is_unmapped;
static PyObject *__pyx_n_s__is_vector_of_sets;
static PyObject *__pyx_n_s__isize;
static PyObject *__pyx_n_s__itertools;
static PyObject *__pyx_n_s__iv;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__length;
static PyObject *__pyx_n_s__log10;
static PyObject *__pyx_n_s__mapq;
static PyObject *__pyx_n_s__matched;
static PyObject *__pyx_n_s__mate_aligned;
static PyObject *__pyx_n_s__mate_is_reverse;
static PyObject *__pyx_n_s__math;
static PyObject *__pyx_n_s__max_mm_qual;
static PyObject *__pyx_n_s__maxint;
static PyObject *__pyx_n_s__memmap;
static PyObject *__pyx_n_s__memmap_dir;
static PyObject *__pyx_n_s__mismatch_prop;
static PyObject *__pyx_n_s__missing;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__mpos;
static PyObject *__pyx_n_s__mrnm;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__ndarray;
static PyObject *__pyx_n_s__none;
static PyObject *__pyx_n_s__noquals;
static PyObject *__pyx_n_s__not_paired_end;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__offset;
static PyObject *__pyx_n_s__open;
static PyObject *__pyx_n_s__ord;
static PyObject *__pyx_n_s__os;
static PyObject *__pyx_n_s__overlaps;
static PyObject *__pyx_n_s__padded;
static PyObject *__pyx_n_s__paired_end;
static PyObject *__pyx_n_s__path;
static PyObject *__pyx_n_s__pattern;
static PyObject *__pyx_n_s__phred;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__property;
static PyObject *__pyx_n_s__pysam;
static PyObject *__pyx_n_s__qfrom;
static PyObject *__pyx_n_s__qname;
static PyObject *__pyx_n_s__qto;
static PyObject *__pyx_n_s__qual;
static PyObject *__pyx_n_s__qualscale;
static PyObject *__pyx_n_s__qualstr;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__raw_optional_fields;
static PyObject *__pyx_n_s__re;
static PyObject *__pyx_n_s__read;
static PyObject *__pyx_n_s__read_as_aligned;
static PyObject *__pyx_n_s__ref_iv;
static PyObject *__pyx_n_s__ref_left;
static PyObject *__pyx_n_s__revcomp_of_;
static PyObject *__pyx_n_s__rfrom;
static PyObject *__pyx_n_s__rstrip;
static PyObject *__pyx_n_s__rto;
static PyObject *__pyx_n_s__samfile;
static PyObject *__pyx_n_s__se;
static PyObject *__pyx_n_s__second;
static PyObject *__pyx_n_s__seq;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__skipped;
static PyObject *__pyx_n_s__solexa;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__start_d;
static PyObject *__pyx_n_s__start_index;
static PyObject *__pyx_n_s__stderr;
static PyObject *__pyx_n_s__step;
static PyObject *__pyx_n_s__steps;
static PyObject *__pyx_n_s__stop;
static PyObject *__pyx_n_s__storage;
static PyObject *__pyx_n_s__strand;
static PyObject *__pyx_n_s__stranded;
static PyObject *__pyx_n_s__sys;
static PyObject *__pyx_n_s__t;
static PyObject *__pyx_n_s__tags;
static PyObject *__pyx_n_s__tid;
static PyObject *__pyx_n_s__track_options;
static PyObject *__pyx_n_s__translate;
static PyObject *__pyx_n_s__trim_left_end;
static PyObject *__pyx_n_s__trim_right_end;
static PyObject *__pyx_n_s__type;
static PyObject *__pyx_n_s__type_;
static PyObject *__pyx_n_s__typecode;
static PyObject *__pyx_n_s__unknown;
static PyObject *__pyx_n_s__unnamed;
static PyObject *__pyx_n_s__upper;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__vec;
static PyObject *__pyx_n_s__w;
static PyObject *__pyx_n_s__warn;
static PyObject *__pyx_n_s__warnings;
static PyObject *__pyx_n_s__write;
static PyObject *__pyx_n_s__write_to_fastq_file;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xrange;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_65;
static PyObject *__pyx_int_67;
static PyObject *__pyx_int_70;
static PyObject *__pyx_int_71;
static PyObject *__pyx_int_84;
static PyObject *__pyx_int_97;
static PyObject *__pyx_int_99;
static PyObject *__pyx_int_103;
static PyObject *__pyx_int_116;
static PyObject *__pyx_k_1;
static PyObject *__pyx_k_36;
static PyObject *__pyx_k_slice_46;
static PyObject *__pyx_k_slice_71;
static PyObject *__pyx_k_slice_72;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_81;
static PyObject *__pyx_k_tuple_91;
static PyObject *__pyx_k_tuple_95;
static PyObject *__pyx_k_tuple_98;
static PyObject *__pyx_k_tuple_100;
static PyObject *__pyx_k_tuple_103;
static PyObject *__pyx_k_tuple_106;
static PyObject *__pyx_k_tuple_109;
static PyObject *__pyx_k_tuple_110;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_115;
static PyObject *__pyx_k_tuple_117;
static PyObject *__pyx_k_tuple_119;
static PyObject *__pyx_k_tuple_122;
static PyObject *__pyx_k_tuple_123;
static PyObject *__pyx_k_tuple_125;
static PyObject *__pyx_k_tuple_134;

/* "HTSeq/_HTSeq.pyx":53
 *    """
 * 
 *    def __init__( GenomicInterval self, str chrom, long start, long end,             # <<<<<<<<<<<<<<
 *          str strand = strand_nostrand ):
 *       """See the class docstring for the meaning of the slots. Note that
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval___init__[] = "See the class docstring for the meaning of the slots. Note that \n      there is also a factory function, 'from_directional', to be used if\n      you wish to specify start_d and length.\n      ";
struct wrapperbase __pyx_wrapperbase_5HTSeq_6_HTSeq_15GenomicInterval___init__;
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chrom = 0;
  long __pyx_v_start;
  long __pyx_v_end;
  PyObject *__pyx_v_strand = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start,&__pyx_n_s__end,&__pyx_n_s__strand,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = __pyx_k_1;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chrom = ((PyObject*)values[0]);
    __pyx_v_start = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_start == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_end = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_end == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_strand = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":59
 *       you wish to specify start_d and length.
 *       """
 *       self.chrom = intern( chrom )             # <<<<<<<<<<<<<<
 *       self.start = start
 *       self.end = end
 */
  __pyx_t_1 = __Pyx_Intern(((PyObject *)__pyx_v_chrom)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __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 = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":60
 *       """
 *       self.chrom = intern( chrom )
 *       self.start = start             # <<<<<<<<<<<<<<
 *       self.end = end
 *       self.strand = strand
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start = __pyx_v_start;

  /* "HTSeq/_HTSeq.pyx":61
 *       self.chrom = intern( chrom )
 *       self.start = start
 *       self.end = end             # <<<<<<<<<<<<<<
 *       self.strand = strand
 *       if self.start > self.end:
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end = __pyx_v_end;

  /* "HTSeq/_HTSeq.pyx":62
 *       self.start = start
 *       self.end = end
 *       self.strand = strand             # <<<<<<<<<<<<<<
 *       if self.start > self.end:
 *          raise ValueError, "start is larger than end"
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__strand, ((PyObject *)__pyx_v_strand)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":63
 *       self.end = end
 *       self.strand = strand
 *       if self.start > self.end:             # <<<<<<<<<<<<<<
 *          raise ValueError, "start is larger than end"
 * 
 */
  __pyx_t_2 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start > ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":64
 *       self.strand = strand
 *       if self.start > self.end:
 *          raise ValueError, "start is larger than end"             # <<<<<<<<<<<<<<
 * 
 *    property strand:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_2), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":67
 * 
 *    property strand:
 *       def __set__( self, strand ):             # <<<<<<<<<<<<<<
 *          strand = intern( strand )
 *          if not( strand is strand_plus or strand is strand_minus or
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strand); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_strand) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_strand);

  /* "HTSeq/_HTSeq.pyx":68
 *    property strand:
 *       def __set__( self, strand ):
 *          strand = intern( strand )             # <<<<<<<<<<<<<<
 *          if not( strand is strand_plus or strand is strand_minus or
 *                strand is strand_nostrand ):
 */
  __pyx_t_1 = __Pyx_Intern(__pyx_v_strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_strand);
  __pyx_v_strand = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":69
 *       def __set__( self, strand ):
 *          strand = intern( strand )
 *          if not( strand is strand_plus or strand is strand_minus or             # <<<<<<<<<<<<<<
 *                strand is strand_nostrand ):
 *             raise ValueError, "Strand must be'+', '-', or '.'."
 */
  __pyx_t_2 = (__pyx_v_strand == ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus));
  if (!__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_strand == ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus));
    if (!__pyx_t_3) {

      /* "HTSeq/_HTSeq.pyx":70
 *          strand = intern( strand )
 *          if not( strand is strand_plus or strand is strand_minus or
 *                strand is strand_nostrand ):             # <<<<<<<<<<<<<<
 *             raise ValueError, "Strand must be'+', '-', or '.'."
 *          self._strand = strand
 */
      __pyx_t_4 = (__pyx_v_strand == ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":71
 *          if not( strand is strand_plus or strand is strand_minus or
 *                strand is strand_nostrand ):
 *             raise ValueError, "Strand must be'+', '-', or '.'."             # <<<<<<<<<<<<<<
 *          self._strand = strand
 *       def __get__( self ):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_3), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":72
 *                strand is strand_nostrand ):
 *             raise ValueError, "Strand must be'+', '-', or '.'."
 *          self._strand = strand             # <<<<<<<<<<<<<<
 *       def __get__( self ):
 *          return self._strand
 */
  if (!(likely(PyString_CheckExact(__pyx_v_strand))||((__pyx_v_strand) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_strand)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_strand);
  __Pyx_GIVEREF(__pyx_v_strand);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand = ((PyObject*)__pyx_v_strand);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.strand.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":73
 *             raise ValueError, "Strand must be'+', '-', or '.'."
 *          self._strand = strand
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          return self._strand
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");

  /* "HTSeq/_HTSeq.pyx":74
 *          self._strand = strand
 *       def __get__( self ):
 *          return self._strand             # <<<<<<<<<<<<<<
 * 
 *    def __reduce__( GenomicInterval self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":76
 *          return self._strand
 * 
 *    def __reduce__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *       return GenomicInterval, ( self.chrom, self.start, self.end,
 *          self.strand )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__");

  /* "HTSeq/_HTSeq.pyx":77
 * 
 *    def __reduce__( GenomicInterval self ):
 *       return GenomicInterval, ( self.chrom, self.start, self.end,             # <<<<<<<<<<<<<<
 *          self.strand )
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "HTSeq/_HTSeq.pyx":78
 *    def __reduce__( GenomicInterval self ):
 *       return GenomicInterval, ( self.chrom, self.start, self.end,
 *          self.strand )             # <<<<<<<<<<<<<<
 * 
 *    def __copy__( self ):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":80
 *          self.strand )
 * 
 *    def __copy__( self ):             # <<<<<<<<<<<<<<
 *       constr, args = self.__reduce__()
 *       return constr( *args )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_2__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_2__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_constr = NULL;
  PyObject *__pyx_v_args = 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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__copy__");

  /* "HTSeq/_HTSeq.pyx":81
 * 
 *    def __copy__( self ):
 *       constr, args = self.__reduce__()             # <<<<<<<<<<<<<<
 *       return constr( *args )
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____reduce__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 81; __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))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } 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 = 81; __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_L5_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_L5_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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_constr = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_args = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":82
 *    def __copy__( self ):
 *       constr, args = self.__reduce__()
 *       return constr( *args )             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( GenomicInterval self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyObject_Call(__pyx_v_constr, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_constr);
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":84
 *       return constr( *args )
 * 
 *    def __repr__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *       return "<%s object '%s', [%d,%s), strand '%s'>" % \
 *          ( self.__class__.__name__, self.chrom, self.start,
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3__repr__(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;
  PyObject *__pyx_t_4 = NULL;
  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("__repr__");

  /* "HTSeq/_HTSeq.pyx":85
 * 
 *    def __repr__( GenomicInterval self ):
 *       return "<%s object '%s', [%d,%s), strand '%s'>" % \             # <<<<<<<<<<<<<<
 *          ( self.__class__.__name__, self.chrom, self.start,
 *            str(self.end) if self.end != sys.maxint else "Inf", self.strand )
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":86
 *    def __repr__( GenomicInterval self ):
 *       return "<%s object '%s', [%d,%s), strand '%s'>" % \
 *          ( self.__class__.__name__, self.chrom, self.start,             # <<<<<<<<<<<<<<
 *            str(self.end) if self.end != sys.maxint else "Inf", self.strand )
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "HTSeq/_HTSeq.pyx":87
 *       return "<%s object '%s', [%d,%s), strand '%s'>" % \
 *          ( self.__class__.__name__, self.chrom, self.start,
 *            str(self.end) if self.end != sys.maxint else "Inf", self.strand )             # <<<<<<<<<<<<<<
 * 
 *    def __str__( GenomicInterval self ):
 */
  __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); 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_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__maxint); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_6, Py_NE); 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(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_7) {
    __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); 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_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), 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_6)); __pyx_t_6 = 0;
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(((PyObject *)__pyx_n_s__Inf));
    __pyx_t_3 = __pyx_n_s__Inf;
  }
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); 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_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_r = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":89
 *            str(self.end) if self.end != sys.maxint else "Inf", self.strand )
 * 
 *    def __str__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return "%s:[%d,%s)/%s" % \
 *             ( self.chrom, self.start, str(self.end) if self.end != sys.maxint else "Inf", self.strand )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_4__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_4__str__(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;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__");

  /* "HTSeq/_HTSeq.pyx":90
 * 
 *    def __str__( GenomicInterval self ):
 *          return "%s:[%d,%s)/%s" % \             # <<<<<<<<<<<<<<
 *             ( self.chrom, self.start, str(self.end) if self.end != sys.maxint else "Inf", self.strand )
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":91
 *    def __str__( GenomicInterval self ):
 *          return "%s:[%d,%s)/%s" % \
 *             ( self.chrom, self.start, str(self.end) if self.end != sys.maxint else "Inf", self.strand )             # <<<<<<<<<<<<<<
 * 
 *    property length:
 */
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__maxint); 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(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(((PyObject *)__pyx_n_s__Inf));
    __pyx_t_2 = __pyx_n_s__Inf;
  }
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":99
 *       is '-', in which case 'start' is changed."""
 * 
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return self.end - self.start
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length___get__(PyObject *__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__");

  /* "HTSeq/_HTSeq.pyx":100
 * 
 *       def __get__( GenomicInterval self ):
 *          return self.end - self.start             # <<<<<<<<<<<<<<
 * 
 *       def __set__( GenomicInterval self, long newLength ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end - ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start)); 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_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("HTSeq._HTSeq.GenomicInterval.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":102
 *          return self.end - self.start
 * 
 *       def __set__( GenomicInterval self, long newLength ):             # <<<<<<<<<<<<<<
 *          if self._strand is not strand_minus:
 *             self.end = self.start + newLength
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newLength); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newLength) {
  long __pyx_v_newLength;
  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__");
  assert(__pyx_arg_newLength); {
    __pyx_v_newLength = __Pyx_PyInt_AsLong(__pyx_arg_newLength); if (unlikely((__pyx_v_newLength == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.length.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":103
 * 
 *       def __set__( GenomicInterval self, long newLength ):
 *          if self._strand is not strand_minus:             # <<<<<<<<<<<<<<
 *             self.end = self.start + newLength
 *          else:
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand != __pyx_v_5HTSeq_6_HTSeq_strand_minus);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":104
 *       def __set__( GenomicInterval self, long newLength ):
 *          if self._strand is not strand_minus:
 *             self.end = self.start + newLength             # <<<<<<<<<<<<<<
 *          else:
 *             self.start = self.end - newLength
 */
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start + __pyx_v_newLength);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":106
 *             self.end = self.start + newLength
 *          else:
 *             self.start = self.end - newLength             # <<<<<<<<<<<<<<
 * 
 *    property start_d:
 */
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end - __pyx_v_newLength);
  }
  __pyx_L5:;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":114
 *       length stays unchanged."""
 * 
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          if self._strand is not strand_minus:
 *             return self.start
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "HTSeq/_HTSeq.pyx":115
 * 
 *       def __get__( GenomicInterval self ):
 *          if self._strand is not strand_minus:             # <<<<<<<<<<<<<<
 *             return self.start
 *          else:
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand != __pyx_v_5HTSeq_6_HTSeq_strand_minus);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":116
 *       def __get__( GenomicInterval self ):
 *          if self._strand is not strand_minus:
 *             return self.start             # <<<<<<<<<<<<<<
 *          else:
 *             return self.end - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); 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_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":118
 *             return self.start
 *          else:
 *             return self.end - 1             # <<<<<<<<<<<<<<
 * 
 *       def __set__( GenomicInterval self, long newStartd ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.start_d.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":120
 *             return self.end - 1
 * 
 *       def __set__( GenomicInterval self, long newStartd ):             # <<<<<<<<<<<<<<
 *          if self._strand is not strand_minus:
 *             self.end = newStartd + self.length
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newStartd); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newStartd) {
  long __pyx_v_newStartd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_newStartd); {
    __pyx_v_newStartd = __Pyx_PyInt_AsLong(__pyx_arg_newStartd); if (unlikely((__pyx_v_newStartd == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.start_d.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":121
 * 
 *       def __set__( GenomicInterval self, long newStartd ):
 *          if self._strand is not strand_minus:             # <<<<<<<<<<<<<<
 *             self.end = newStartd + self.length
 *             self.start = newStartd
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand != __pyx_v_5HTSeq_6_HTSeq_strand_minus);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":122
 *       def __set__( GenomicInterval self, long newStartd ):
 *          if self._strand is not strand_minus:
 *             self.end = newStartd + self.length             # <<<<<<<<<<<<<<
 *             self.start = newStartd
 *          else:
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_newStartd); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __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_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end = __pyx_t_5;

    /* "HTSeq/_HTSeq.pyx":123
 *          if self._strand is not strand_minus:
 *             self.end = newStartd + self.length
 *             self.start = newStartd             # <<<<<<<<<<<<<<
 *          else:
 *             self.start = newStartd + 1 - self.length
 */
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start = __pyx_v_newStartd;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":125
 *             self.start = newStartd
 *          else:
 *             self.start = newStartd + 1 - self.length             # <<<<<<<<<<<<<<
 *             self.end = newStartd + 1
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_newStartd + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start = __pyx_t_5;

    /* "HTSeq/_HTSeq.pyx":126
 *          else:
 *             self.start = newStartd + 1 - self.length
 *             self.end = newStartd + 1             # <<<<<<<<<<<<<<
 * 
 *    property end_d:
 */
    ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end = (__pyx_v_newStartd + 1);
  }
  __pyx_L5:;

  __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_AddTraceback("HTSeq._HTSeq.GenomicInterval.start_d.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":130
 *    property end_d:
 * 
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          if self._strand is not strand_minus:
 *             return self.end
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5end_d___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5end_d___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "HTSeq/_HTSeq.pyx":131
 * 
 *       def __get__( GenomicInterval self ):
 *          if self._strand is not strand_minus:             # <<<<<<<<<<<<<<
 *             return self.end
 *          else:
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand != __pyx_v_5HTSeq_6_HTSeq_strand_minus);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":132
 *       def __get__( GenomicInterval self ):
 *          if self._strand is not strand_minus:
 *             return self.end             # <<<<<<<<<<<<<<
 *          else:
 *             return self.start - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":134
 *             return self.end
 *          else:
 *             return self.start - 1             # <<<<<<<<<<<<<<
 * 
 *    property start_as_pos:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyInt_FromLong((((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.end_d.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":137
 * 
 *    property start_as_pos:
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return GenomicPosition( self.chrom, self.start, self. strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12start_as_pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12start_as_pos___get__(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("__get__");

  /* "HTSeq/_HTSeq.pyx":138
 *    property start_as_pos:
 *       def __get__( GenomicInterval self ):
 *          return GenomicPosition( self.chrom, self.start, self. strand )             # <<<<<<<<<<<<<<
 * 
 *    property end_as_pos:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.start_as_pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":141
 * 
 *    property end_as_pos:
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return GenomicPosition( self.chrom, self.end, self. strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10end_as_pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10end_as_pos___get__(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("__get__");

  /* "HTSeq/_HTSeq.pyx":142
 *    property end_as_pos:
 *       def __get__( GenomicInterval self ):
 *          return GenomicPosition( self.chrom, self.end, self. strand )             # <<<<<<<<<<<<<<
 * 
 *    property start_d_as_pos:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.end_as_pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":145
 * 
 *    property start_d_as_pos:
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return GenomicPosition( self.chrom, self.start_d, self. strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_14start_d_as_pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_14start_d_as_pos___get__(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("__get__");

  /* "HTSeq/_HTSeq.pyx":146
 *    property start_d_as_pos:
 *       def __get__( GenomicInterval self ):
 *          return GenomicPosition( self.chrom, self.start_d, self. strand )             # <<<<<<<<<<<<<<
 * 
 *    property end_d_as_pos:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start_d); 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 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_3), NULL); 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.start_d_as_pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":149
 * 
 *    property end_d_as_pos:
 *       def __get__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *          return GenomicPosition( self.chrom, self.end_d, self. strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12end_d_as_pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12end_d_as_pos___get__(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("__get__");

  /* "HTSeq/_HTSeq.pyx":150
 *    property end_d_as_pos:
 *       def __get__( GenomicInterval self ):
 *          return GenomicPosition( self.chrom, self.end_d, self. strand )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__end_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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 = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.end_d_as_pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":153
 * 
 * 
 *    def __richcmp__( GenomicInterval self, GenomicInterval other, int op ):             # <<<<<<<<<<<<<<
 *       if op == 2:  # ==
 *          if other == None:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":159
 *          return self._strand is other._strand and \
 *             self.start == other.start and self.end == other.end
 *       elif op == 3:  # !=             # <<<<<<<<<<<<<<
 *          return not ( self == other )
 *       else:
 */
  switch (__pyx_v_op) {

    /* "HTSeq/_HTSeq.pyx":154
 * 
 *    def __richcmp__( GenomicInterval self, GenomicInterval other, int op ):
 *       if op == 2:  # ==             # <<<<<<<<<<<<<<
 *          if other == None:
 *             return False
 */
    case 2:

    /* "HTSeq/_HTSeq.pyx":155
 *    def __richcmp__( GenomicInterval self, GenomicInterval other, int op ):
 *       if op == 2:  # ==
 *          if other == None:             # <<<<<<<<<<<<<<
 *             return False
 *          return self._strand is other._strand and \
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_other, Py_None, Py_EQ); 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_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":156
 *       if op == 2:  # ==
 *          if other == None:
 *             return False             # <<<<<<<<<<<<<<
 *          return self._strand is other._strand and \
 *             self.start == other.start and self.end == other.end
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __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_L5;
    }
    __pyx_L5:;

    /* "HTSeq/_HTSeq.pyx":157
 *          if other == None:
 *             return False
 *          return self._strand is other._strand and \             # <<<<<<<<<<<<<<
 *             self.start == other.start and self.end == other.end
 *       elif op == 3:  # !=
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->_strand == ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_other)->_strand);
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":158
 *             return False
 *          return self._strand is other._strand and \
 *             self.start == other.start and self.end == other.end             # <<<<<<<<<<<<<<
 *       elif op == 3:  # !=
 *          return not ( self == other )
 */
      __pyx_t_3 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start == ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_other)->start);
      if (__pyx_t_3) {
        __pyx_t_4 = (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end == ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_other)->end);
        __pyx_t_5 = __pyx_t_4;
      } else {
        __pyx_t_5 = __pyx_t_3;
      }
      __pyx_t_3 = __pyx_t_5;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "HTSeq/_HTSeq.pyx":159
 *          return self._strand is other._strand and \
 *             self.start == other.start and self.end == other.end
 *       elif op == 3:  # !=             # <<<<<<<<<<<<<<
 *          return not ( self == other )
 *       else:
 */
    case 3:

    /* "HTSeq/_HTSeq.pyx":160
 *             self.start == other.start and self.end == other.end
 *       elif op == 3:  # !=
 *          return not ( self == other )             # <<<<<<<<<<<<<<
 *       else:
 *          raise NotImplementedError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "HTSeq/_HTSeq.pyx":162
 *          return not ( self == other )
 *       else:
 *          raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *    def __hash__( GenomicInterval self ):
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":164
 *          raise NotImplementedError
 * 
 *    def __hash__( GenomicInterval self ):             # <<<<<<<<<<<<<<
 *       return hash( ( self.chrom, self.start, self.end, self.strand ) )
 * 
 */

static Py_hash_t __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_hash_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__");

  /* "HTSeq/_HTSeq.pyx":165
 * 
 *    def __hash__( GenomicInterval self ):
 *       return hash( ( self.chrom, self.start, self.end, self.strand ) )             # <<<<<<<<<<<<<<
 * 
 *    cpdef is_contained_in( GenomicInterval self, GenomicInterval iv ):
 */
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_5 = PyObject_Hash(((PyObject *)__pyx_t_4)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":167
 *       return hash( ( self.chrom, self.start, self.end, self.strand ) )
 * 
 *    cpdef is_contained_in( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       is fully within the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_is_contained_in(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv, 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_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("is_contained_in");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__is_contained_in); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_iv));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_iv));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
      __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 = 167; __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;
  }

  /* "HTSeq/_HTSeq.pyx":178
 *         - self.end <= iv.end
 *       """
 *       if iv == None:             # <<<<<<<<<<<<<<
 *          return False
 *       if self.chrom != iv.chrom:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_iv), Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":179
 *       """
 *       if iv == None:
 *          return False             # <<<<<<<<<<<<<<
 *       if self.chrom != iv.chrom:
 *          return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":180
 *       if iv == None:
 *          return False
 *       if self.chrom != iv.chrom:             # <<<<<<<<<<<<<<
 *          return False
 *       if self._strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->chrom), ((PyObject *)__pyx_v_iv->chrom), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":181
 *          return False
 *       if self.chrom != iv.chrom:
 *          return False             # <<<<<<<<<<<<<<
 *       if self._strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv._strand:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":182
 *       if self.chrom != iv.chrom:
 *          return False
 *       if self._strand is not strand_nostrand and iv.strand is not strand_nostrand and \             # <<<<<<<<<<<<<<
 *             self.strand is not iv._strand:
 *          return False
 */
  __pyx_t_4 = (__pyx_v_self->_strand != __pyx_v_5HTSeq_6_HTSeq_strand_nostrand);
  if (__pyx_t_4) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":183
 *          return False
 *       if self._strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv._strand:             # <<<<<<<<<<<<<<
 *          return False
 *       if self.start < iv.start or self.end > iv.end:
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = (__pyx_t_1 != ((PyObject *)__pyx_v_iv->_strand));
      __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_4;
  }
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":184
 *       if self._strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv._strand:
 *          return False             # <<<<<<<<<<<<<<
 *       if self.start < iv.start or self.end > iv.end:
 *          return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __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_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":185
 *             self.strand is not iv._strand:
 *          return False
 *       if self.start < iv.start or self.end > iv.end:             # <<<<<<<<<<<<<<
 *          return False
 *       return True
 */
  __pyx_t_5 = (__pyx_v_self->start < __pyx_v_iv->start);
  if (!__pyx_t_5) {
    __pyx_t_4 = (__pyx_v_self->end > __pyx_v_iv->end);
    __pyx_t_7 = __pyx_t_4;
  } else {
    __pyx_t_7 = __pyx_t_5;
  }
  if (__pyx_t_7) {

    /* "HTSeq/_HTSeq.pyx":186
 *          return False
 *       if self.start < iv.start or self.end > iv.end:
 *          return False             # <<<<<<<<<<<<<<
 *       return True
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __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_L6;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":187
 *       if self.start < iv.start or self.end > iv.end:
 *          return False
 *       return True             # <<<<<<<<<<<<<<
 * 
 *    cpdef contains( GenomicInterval self, GenomicInterval iv ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.is_contained_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":167
 *       return hash( ( self.chrom, self.start, self.end, self.strand ) )
 * 
 *    cpdef is_contained_in( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       is fully within the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in[] = "Returns a boolean value indicating whether the 'self' interval \n      is fully within the 'iv' interval.\n      \n      This is deemed the case if\007\n        - both are on the same chromosome, and    \n        - both are on the same strand, or at least one of them is\n           not stranded (i.e., has strand == '.'), and\n        - self.start >= iv.start, and\n        - self.end <= iv.end\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in(PyObject *__pyx_v_self, PyObject *__pyx_v_iv) {
  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("is_contained_in");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->__pyx_vtab)->is_contained_in(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self), ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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("HTSeq._HTSeq.GenomicInterval.is_contained_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":189
 *       return True
 * 
 *    cpdef contains( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       fully contains the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_8contains(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_contains(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv, 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("contains");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__contains); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_8contains)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_iv));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_iv));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
      __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 = 189; __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;
  }

  /* "HTSeq/_HTSeq.pyx":195
 *       See 'is_contained_in' for the exact criteria.
 *       """
 *       if iv == None:             # <<<<<<<<<<<<<<
 *             return False
 *       return iv.is_contained_in( self )
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_iv), Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":196
 *       """
 *       if iv == None:
 *             return False             # <<<<<<<<<<<<<<
 *       return iv.is_contained_in( self )
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":197
 *       if iv == None:
 *             return False
 *       return iv.is_contained_in( self )             # <<<<<<<<<<<<<<
 * 
 *    cpdef overlaps( GenomicInterval self, GenomicInterval iv ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv->__pyx_vtab)->is_contained_in(__pyx_v_iv, __pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.contains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":189
 *       return True
 * 
 *    cpdef contains( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       fully contains the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_8contains(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_8contains[] = "Returns a boolean value indicating whether the 'self' interval \n      fully contains the 'iv' interval.\n\n      See 'is_contained_in' for the exact criteria.\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_8contains(PyObject *__pyx_v_self, PyObject *__pyx_v_iv) {
  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("contains");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->__pyx_vtab)->contains(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self), ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __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("HTSeq._HTSeq.GenomicInterval.contains", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":199
 *       return iv.is_contained_in( self )
 * 
 *    cpdef overlaps( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       overlaps the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_overlaps(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv, 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_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("overlaps");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__overlaps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_iv));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_iv));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
      __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 = 199; __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;
  }

  /* "HTSeq/_HTSeq.pyx":209
 *         - the actual intervals overlap
 *       """
 *       if iv == None:             # <<<<<<<<<<<<<<
 *          return False
 *       if self.chrom != iv.chrom:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_iv), Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":210
 *       """
 *       if iv == None:
 *          return False             # <<<<<<<<<<<<<<
 *       if self.chrom != iv.chrom:
 *          return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __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;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":211
 *       if iv == None:
 *          return False
 *       if self.chrom != iv.chrom:             # <<<<<<<<<<<<<<
 *          return False
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->chrom), ((PyObject *)__pyx_v_iv->chrom), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":212
 *          return False
 *       if self.chrom != iv.chrom:
 *          return False             # <<<<<<<<<<<<<<
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __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;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":213
 *       if self.chrom != iv.chrom:
 *          return False
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \             # <<<<<<<<<<<<<<
 *             self.strand is not iv.strand:
 *          return False
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":214
 *          return False
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:             # <<<<<<<<<<<<<<
 *          return False
 *       if self.start <= iv.start:
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = (__pyx_t_1 != __pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_4;
  }
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":215
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:
 *          return False             # <<<<<<<<<<<<<<
 *       if self.start <= iv.start:
 *          return self.end > iv.start
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":216
 *             self.strand is not iv.strand:
 *          return False
 *       if self.start <= iv.start:             # <<<<<<<<<<<<<<
 *          return self.end > iv.start
 *       else:
 */
  __pyx_t_5 = (__pyx_v_self->start <= __pyx_v_iv->start);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":217
 *          return False
 *       if self.start <= iv.start:
 *          return self.end > iv.start             # <<<<<<<<<<<<<<
 *       else:
 *          return iv.end > self.start
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_self->end > __pyx_v_iv->start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":219
 *          return self.end > iv.start
 *       else:
 *          return iv.end > self.start             # <<<<<<<<<<<<<<
 * 
 *    def xrange( GenomicInterval self, long int step = 1 ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_iv->end > __pyx_v_self->start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __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("HTSeq._HTSeq.GenomicInterval.overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":199
 *       return iv.is_contained_in( self )
 * 
 *    cpdef overlaps( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Returns a boolean value indicating whether the 'self' interval
 *       overlaps the 'iv' interval.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps[] = "Returns a boolean value indicating whether the 'self' interval \n      overlaps the 'iv' interval.\n      \n      This is deemed the case if\n        - both are on the same chromosome, and    \n        - both are on the same strand, or at least one of them is\n           not stranded (i.e., has strand == '.'), and\n        - the actual intervals overlap\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps(PyObject *__pyx_v_self, PyObject *__pyx_v_iv) {
  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("overlaps");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->__pyx_vtab)->overlaps(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self), ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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("HTSeq._HTSeq.GenomicInterval.overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":221
 *          return iv.end > self.start
 * 
 *    def xrange( GenomicInterval self, long int step = 1 ):             # <<<<<<<<<<<<<<
 *       """Generate an iterator over the GenomicPositions covered by the interval,
 *       running from start to end.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10xrange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_10xrange[] = "Generate an iterator over the GenomicPositions covered by the interval,\n      running from start to end.\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10xrange(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_step;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__step,0};
  __Pyx_RefNannySetupContext("xrange");
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__step);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "xrange") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_step = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_step == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_step = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xrange", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.xrange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":225
 *       running from start to end.
 *       """
 *       return _HTSeq_internal.GenomicInterval_xrange( self, step )             # <<<<<<<<<<<<<<
 * 
 *    def xrange_d( GenomicInterval self, long int step = 1 ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___HTSeq_internal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_step); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  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 = 225; __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_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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.xrange", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":227
 *       return _HTSeq_internal.GenomicInterval_xrange( self, step )
 * 
 *    def xrange_d( GenomicInterval self, long int step = 1 ):             # <<<<<<<<<<<<<<
 *       """Generate an iterator over the GenomicPositions covered by the interval.
 *       running from start_d to end_d.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_11xrange_d(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_11xrange_d[] = "Generate an iterator over the GenomicPositions covered by the interval.\n      running from start_d to end_d.\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_11xrange_d(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_step;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__step,0};
  __Pyx_RefNannySetupContext("xrange_d");
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__step);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "xrange_d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_step = __Pyx_PyInt_AsLong(values[0]); if (unlikely((__pyx_v_step == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_step = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("xrange_d", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.xrange_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":231
 *       running from start_d to end_d.
 *       """
 *       return _HTSeq_internal.GenomicInterval_xranged( self, step )             # <<<<<<<<<<<<<<
 * 
 *    cpdef extend_to_include( GenomicInterval self, GenomicInterval iv ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___HTSeq_internal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_step); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  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 = 231; __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_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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.xrange_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":233
 *       return _HTSeq_internal.GenomicInterval_xranged( self, step )
 * 
 *    cpdef extend_to_include( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Extend the interval such that it includes iv."""
 *       if iv is None:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_extend_to_include(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv, 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_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  long __pyx_t_9;
  long __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("extend_to_include");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__extend_to_include); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_iv));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_iv));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
      __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 = 233; __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;
  }

  /* "HTSeq/_HTSeq.pyx":235
 *    cpdef extend_to_include( GenomicInterval self, GenomicInterval iv ):
 *       """Extend the interval such that it includes iv."""
 *       if iv is None:             # <<<<<<<<<<<<<<
 *          raise TypeError, "Cannot extend an interval to include None."
 *       if self.chrom != iv.chrom:
 */
  __pyx_t_4 = (((PyObject *)__pyx_v_iv) == Py_None);
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":236
 *       """Extend the interval such that it includes iv."""
 *       if iv is None:
 *          raise TypeError, "Cannot extend an interval to include None."             # <<<<<<<<<<<<<<
 *       if self.chrom != iv.chrom:
 *          raise ValueError, "Cannot extend an interval to include an interval on another chromosome."
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_8), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":237
 *       if iv is None:
 *          raise TypeError, "Cannot extend an interval to include None."
 *       if self.chrom != iv.chrom:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Cannot extend an interval to include an interval on another chromosome."
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->chrom), ((PyObject *)__pyx_v_iv->chrom), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":238
 *          raise TypeError, "Cannot extend an interval to include None."
 *       if self.chrom != iv.chrom:
 *          raise ValueError, "Cannot extend an interval to include an interval on another chromosome."             # <<<<<<<<<<<<<<
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_9), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":239
 *       if self.chrom != iv.chrom:
 *          raise ValueError, "Cannot extend an interval to include an interval on another chromosome."
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \             # <<<<<<<<<<<<<<
 *             self.strand is not iv.strand:
 *          raise ValueError, "Cannot extend an interval to include an interval on another strand."
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":240
 *          raise ValueError, "Cannot extend an interval to include an interval on another chromosome."
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Cannot extend an interval to include an interval on another strand."
 *       self.start = min( self.start, iv.start )
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = (__pyx_t_1 != __pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_4;
  }
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":241
 *       if self.strand is not strand_nostrand and iv.strand is not strand_nostrand and \
 *             self.strand is not iv.strand:
 *          raise ValueError, "Cannot extend an interval to include an interval on another strand."             # <<<<<<<<<<<<<<
 *       self.start = min( self.start, iv.start )
 *       self.end = max( self.end, iv.end )
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_10), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":242
 *             self.strand is not iv.strand:
 *          raise ValueError, "Cannot extend an interval to include an interval on another strand."
 *       self.start = min( self.start, iv.start )             # <<<<<<<<<<<<<<
 *       self.end = max( self.end, iv.end )
 * 
 */
  __pyx_t_8 = __pyx_v_iv->start;
  __pyx_t_9 = __pyx_v_self->start;
  if ((__pyx_t_8 < __pyx_t_9)) {
    __pyx_t_10 = __pyx_t_8;
  } else {
    __pyx_t_10 = __pyx_t_9;
  }
  __pyx_v_self->start = __pyx_t_10;

  /* "HTSeq/_HTSeq.pyx":243
 *          raise ValueError, "Cannot extend an interval to include an interval on another strand."
 *       self.start = min( self.start, iv.start )
 *       self.end = max( self.end, iv.end )             # <<<<<<<<<<<<<<
 * 
 *    def copy( self ):
 */
  __pyx_t_10 = __pyx_v_iv->end;
  __pyx_t_8 = __pyx_v_self->end;
  if ((__pyx_t_10 > __pyx_t_8)) {
    __pyx_t_9 = __pyx_t_10;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_v_self->end = __pyx_t_9;

  __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("HTSeq._HTSeq.GenomicInterval.extend_to_include", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":233
 *       return _HTSeq_internal.GenomicInterval_xranged( self, step )
 * 
 *    cpdef extend_to_include( GenomicInterval self, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       """Extend the interval such that it includes iv."""
 *       if iv is None:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include(PyObject *__pyx_v_self, PyObject *__pyx_v_iv); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include[] = "Extend the interval such that it includes iv.";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include(PyObject *__pyx_v_self, PyObject *__pyx_v_iv) {
  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("extend_to_include");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->__pyx_vtab)->extend_to_include(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self), ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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("HTSeq._HTSeq.GenomicInterval.extend_to_include", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":245
 *       self.end = max( self.end, iv.end )
 * 
 *    def copy( self ):             # <<<<<<<<<<<<<<
 *       return GenomicInterval( self.chrom, self.start, self.end, self.strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_13copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_13copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy");

  /* "HTSeq/_HTSeq.pyx":246
 * 
 *    def copy( self ):
 *       return GenomicInterval( self.chrom, self.start, self.end, self.strand )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  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);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":5
 * cdef class GenomicInterval:
 * 
 *    cdef public str chrom             # <<<<<<<<<<<<<<
 *    cdef public long start
 *    cdef public long end
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.chrom.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->chrom = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":6
 * 
 *    cdef public str chrom
 *    cdef public long start             # <<<<<<<<<<<<<<
 *    cdef public long end
 *    cdef str _strand
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __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("HTSeq._HTSeq.GenomicInterval.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->start = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":7
 *    cdef public str chrom
 *    cdef public long start
 *    cdef public long end             # <<<<<<<<<<<<<<
 *    cdef str _strand
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __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("HTSeq._HTSeq.GenomicInterval.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_self)->end = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval.end.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":249
 * 
 * 
 * def GenomicInterval_from_directional( str chrom, long int start_d, long int length, str strand="." ):             # <<<<<<<<<<<<<<
 *    strand = intern( strand )
 *    if strand.se is not strand_minus:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_GenomicInterval_from_directional(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5HTSeq_6_HTSeq_GenomicInterval_from_directional = {__Pyx_NAMESTR("GenomicInterval_from_directional"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_GenomicInterval_from_directional, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_GenomicInterval_from_directional(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chrom = 0;
  long __pyx_v_start_d;
  long __pyx_v_length;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__start_d,&__pyx_n_s__length,&__pyx_n_s__strand,0};
  __Pyx_RefNannySetupContext("GenomicInterval_from_directional");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject*)__pyx_kp_s_11);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_d);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("GenomicInterval_from_directional", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("GenomicInterval_from_directional", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "GenomicInterval_from_directional") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chrom = ((PyObject*)values[0]);
    __pyx_v_start_d = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_start_d == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_length = __Pyx_PyInt_AsLong(values[2]); if (unlikely((__pyx_v_length == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_strand = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("GenomicInterval_from_directional", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval_from_directional", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_strand);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":250
 * 
 * def GenomicInterval_from_directional( str chrom, long int start_d, long int length, str strand="." ):
 *    strand = intern( strand )             # <<<<<<<<<<<<<<
 *    if strand.se is not strand_minus:
 *       return GenomicInterval( chrom, start_d, start_d+length, strand )
 */
  __pyx_t_1 = __Pyx_Intern(((PyObject *)__pyx_v_strand)); 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);
  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 = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_strand));
  __pyx_v_strand = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":251
 * def GenomicInterval_from_directional( str chrom, long int start_d, long int length, str strand="." ):
 *    strand = intern( strand )
 *    if strand.se is not strand_minus:             # <<<<<<<<<<<<<<
 *       return GenomicInterval( chrom, start_d, start_d+length, strand )
 *    else:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_strand), __pyx_n_s__se); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":252
 *    strand = intern( strand )
 *    if strand.se is not strand_minus:
 *       return GenomicInterval( chrom, start_d, start_d+length, strand )             # <<<<<<<<<<<<<<
 *    else:
 *       return GenomicInterval( chrom, start_d-length+1, start_d+1, strand )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_start_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_start_d + __pyx_v_length)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_strand));
    PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_strand));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":254
 *       return GenomicInterval( chrom, start_d, start_d+length, strand )
 *    else:
 *       return GenomicInterval( chrom, start_d-length+1, start_d+1, strand )             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyInt_FromLong(((__pyx_v_start_d - __pyx_v_length) + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong((__pyx_v_start_d + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_strand));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_strand));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __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_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicInterval_from_directional", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":275
 *    """
 * 
 *    def __init__( self, str chrom, long int pos, str strand='.' ):             # <<<<<<<<<<<<<<
 *       GenomicInterval.__init__( self, chrom, pos, pos+1, strand )
 * 
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chrom = 0;
  long __pyx_v_pos;
  PyObject *__pyx_v_strand = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__pos,&__pyx_n_s__strand,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject*)__pyx_kp_s_11);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chrom = ((PyObject*)values[0]);
    __pyx_v_pos = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_pos == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_strand = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":276
 * 
 *    def __init__( self, str chrom, long int pos, str strand='.' ):
 *       GenomicInterval.__init__( self, chrom, pos, pos+1, strand )             # <<<<<<<<<<<<<<
 * 
 *    property pos:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong((__pyx_v_pos + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_strand));
  PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_v_strand));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":284
 *       """
 * 
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          return self.start_d
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos___get__(PyObject *__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__");

  /* "HTSeq/_HTSeq.pyx":285
 * 
 *       def __get__( self ):
 *          return self.start_d             # <<<<<<<<<<<<<<
 * 
 *       def __set__( self, long newValue ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__start_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __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("HTSeq._HTSeq.GenomicPosition.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":287
 *          return self.start_d
 * 
 *       def __set__( self, long newValue ):             # <<<<<<<<<<<<<<
 *          self.start_d = newValue
 * 
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newValue); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_newValue) {
  long __pyx_v_newValue;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  assert(__pyx_arg_newValue); {
    __pyx_v_newValue = __Pyx_PyInt_AsLong(__pyx_arg_newValue); if (unlikely((__pyx_v_newValue == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":288
 * 
 *       def __set__( self, long newValue ):
 *          self.start_d = newValue             # <<<<<<<<<<<<<<
 * 
 *    property end:
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_newValue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__start_d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":292
 *    property end:
 * 
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          return self.start + 1
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3end___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3end___get__(PyObject *__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__");

  /* "HTSeq/_HTSeq.pyx":293
 * 
 *       def __get__( self ):
 *          return self.start + 1             # <<<<<<<<<<<<<<
 * 
 *    property length:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong((((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.start + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __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("HTSeq._HTSeq.GenomicPosition.end.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":297
 *    property length:
 * 
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          return 1
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_6length___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_6length___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");

  /* "HTSeq/_HTSeq.pyx":298
 * 
 *       def __get__( self ):
 *          return 1             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_1);
  __pyx_r = __pyx_int_1;
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":300
 *          return 1
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       return "<%s object '%s':%d, strand '%s'>" % \
 *          ( self.__class__.__name__, self.chrom, self.pos, self.strand )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_1__repr__(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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "HTSeq/_HTSeq.pyx":301
 * 
 *    def __repr__( self ):
 *       return "<%s object '%s':%d, strand '%s'>" % \             # <<<<<<<<<<<<<<
 *          ( self.__class__.__name__, self.chrom, self.pos, self.strand )
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":302
 *    def __repr__( self ):
 *       return "<%s object '%s':%d, strand '%s'>" % \
 *          ( self.__class__.__name__, self.chrom, self.pos, self.strand )             # <<<<<<<<<<<<<<
 * 
 *    def __str__( self ):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __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_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":304
 *          ( self.__class__.__name__, self.chrom, self.pos, self.strand )
 * 
 *    def __str__( self ):             # <<<<<<<<<<<<<<
 *       return "%s:%d/%s" % ( self.chrom, self.pos, self.strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_2__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_2__str__(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__");

  /* "HTSeq/_HTSeq.pyx":305
 * 
 *    def __str__( self ):
 *       return "%s:%d/%s" % ( self.chrom, self.pos, self.strand )             # <<<<<<<<<<<<<<
 * 
 *    def __reduce__( GenomicPosition self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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 = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  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_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":307
 *       return "%s:%d/%s" % ( self.chrom, self.pos, self.strand )
 * 
 *    def __reduce__( GenomicPosition self ):             # <<<<<<<<<<<<<<
 *       return GenomicPosition, ( self.chrom, self.pos, self.strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("__reduce__");

  /* "HTSeq/_HTSeq.pyx":308
 * 
 *    def __reduce__( GenomicPosition self ):
 *       return GenomicPosition, ( self.chrom, self.pos, self.strand )             # <<<<<<<<<<<<<<
 * 
 *    def copy( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strand); if (unlikely(!__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_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  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_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":310
 *       return GenomicPosition, ( self.chrom, self.pos, self.strand )
 * 
 *    def copy( self ):             # <<<<<<<<<<<<<<
 *       return GenomicPosition( self.chrom, self.pos, self.strand )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_4copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_4copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("copy");

  /* "HTSeq/_HTSeq.pyx":311
 * 
 *    def copy( self ):
 *       return GenomicPosition( self.chrom, self.pos, self.strand )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__pos); 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_GetAttr(__pyx_v_self, __pyx_n_s__strand); 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_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_self)->__pyx_base.chrom));
  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_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_3), 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicPosition.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":323
 * 
 *    @classmethod
 *    def create( cls, GenomicInterval iv, str typecode, str storage, str memmap_dir = "" ):             # <<<<<<<<<<<<<<
 *       ncv = cls()
 *       ncv.iv = iv
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_create(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_create(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv = 0;
  PyObject *__pyx_v_typecode = 0;
  PyObject *__pyx_v_storage = 0;
  PyObject *__pyx_v_memmap_dir = 0;
  PyObject *__pyx_v_ncv = NULL;
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iv,&__pyx_n_s__typecode,&__pyx_n_s__storage,&__pyx_n_s__memmap_dir,0};
  __Pyx_RefNannySetupContext("create");
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject*)__pyx_kp_s_14);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iv);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__typecode);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__storage);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("create", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memmap_dir);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "create") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)values[0]);
    __pyx_v_typecode = ((PyObject*)values[1]);
    __pyx_v_storage = ((PyObject*)values[2]);
    __pyx_v_memmap_dir = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("create", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_typecode), (&PyString_Type), 1, "typecode", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_storage), (&PyString_Type), 1, "storage", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_memmap_dir), (&PyString_Type), 1, "memmap_dir", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":324
 *    @classmethod
 *    def create( cls, GenomicInterval iv, str typecode, str storage, str memmap_dir = "" ):
 *       ncv = cls()             # <<<<<<<<<<<<<<
 *       ncv.iv = iv
 *       if storage == "ndarray":
 */
  __pyx_t_1 = PyObject_Call(__pyx_v_cls, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ncv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":325
 *    def create( cls, GenomicInterval iv, str typecode, str storage, str memmap_dir = "" ):
 *       ncv = cls()
 *       ncv.iv = iv             # <<<<<<<<<<<<<<
 *       if storage == "ndarray":
 *          if typecode != 'O':
 */
  if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__iv, ((PyObject *)__pyx_v_iv)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":326
 *       ncv = cls()
 *       ncv.iv = iv
 *       if storage == "ndarray":             # <<<<<<<<<<<<<<
 *          if typecode != 'O':
 *             ncv.array = numpy.zeros( shape = ( iv.length, ), dtype = typecode )
 */
  __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_storage), ((PyObject *)__pyx_n_s__ndarray), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":327
 *       ncv.iv = iv
 *       if storage == "ndarray":
 *          if typecode != 'O':             # <<<<<<<<<<<<<<
 *             ncv.array = numpy.zeros( shape = ( iv.length, ), dtype = typecode )
 *          else:
 */
    __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_typecode), ((PyObject *)__pyx_n_s__O), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":328
 *       if storage == "ndarray":
 *          if typecode != 'O':
 *             ncv.array = numpy.zeros( shape = ( iv.length, ), dtype = typecode )             # <<<<<<<<<<<<<<
 *          else:
 *             ncv.array = numpy.empty( shape = ( iv.length, ), dtype = typecode )
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_typecode)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__array, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":330
 *             ncv.array = numpy.zeros( shape = ( iv.length, ), dtype = typecode )
 *          else:
 *             ncv.array = numpy.empty( shape = ( iv.length, ), dtype = typecode )             # <<<<<<<<<<<<<<
 *             ncv.array[:] = None
 *       elif storage == "memmap":
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_typecode)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__array, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_v_ncv)) { __Pyx_RaiseUnboundLocalError("ncv"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_4 = PyObject_GetAttr(__pyx_v_ncv, __pyx_n_s__array); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "HTSeq/_HTSeq.pyx":331
 *          else:
 *             ncv.array = numpy.empty( shape = ( iv.length, ), dtype = typecode )
 *             ncv.array[:] = None             # <<<<<<<<<<<<<<
 *       elif storage == "memmap":
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,
 */
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_PySequence_SetSlice(__pyx_t_4, 0, PY_SSIZE_T_MAX, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }

  /* "HTSeq/_HTSeq.pyx":332
 *             ncv.array = numpy.empty( shape = ( iv.length, ), dtype = typecode )
 *             ncv.array[:] = None
 *       elif storage == "memmap":             # <<<<<<<<<<<<<<
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )
 */
  __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_storage), ((PyObject *)__pyx_n_s__memmap), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":333
 *             ncv.array[:] = None
 *       elif storage == "memmap":
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,             # <<<<<<<<<<<<<<
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )
 *       elif storage == "step":
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__memmap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_typecode)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "HTSeq/_HTSeq.pyx":334
 *       elif storage == "memmap":
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )             # <<<<<<<<<<<<<<
 *       elif storage == "step":
 *          ncv.array = StepVector.StepVector.create( typecode = typecode )
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__path); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_v_iv->chrom), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)__pyx_v_memmap_dir));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_memmap_dir));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_memmap_dir));
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __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_6)); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__filename), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":333
 *             ncv.array[:] = None
 *       elif storage == "memmap":
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,             # <<<<<<<<<<<<<<
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )
 *       elif storage == "step":
 */
    if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "HTSeq/_HTSeq.pyx":335
 *          ncv.array = numpy.memmap( shape = ( iv.length, ), dtype = typecode,
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )
 *       elif storage == "step":             # <<<<<<<<<<<<<<
 *          ncv.array = StepVector.StepVector.create( typecode = typecode )
 *       else:
 */
  __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_storage), ((PyObject *)__pyx_n_s__step), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":336
 *             filename = os.path.join( memmap_dir, iv.chrom + iv.strand + ".nmm" ), mode='w+' )
 *       elif storage == "step":
 *          ncv.array = StepVector.StepVector.create( typecode = typecode )             # <<<<<<<<<<<<<<
 *       else:
 *          raise ValueError, "Illegal storage mode."
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__StepVector); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StepVector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__create); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__typecode), ((PyObject *)__pyx_v_typecode)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__array, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":338
 *          ncv.array = StepVector.StepVector.create( typecode = typecode )
 *       else:
 *          raise ValueError, "Illegal storage mode."             # <<<<<<<<<<<<<<
 *       ncv._storage = storage
 *       # TODO: Test whether offset works properly
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_17), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":339
 *       else:
 *          raise ValueError, "Illegal storage mode."
 *       ncv._storage = storage             # <<<<<<<<<<<<<<
 *       # TODO: Test whether offset works properly
 *       ncv.offset = iv.start
 */
  if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s___storage, ((PyObject *)__pyx_v_storage)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":341
 *       ncv._storage = storage
 *       # TODO: Test whether offset works properly
 *       ncv.offset = iv.start             # <<<<<<<<<<<<<<
 *       ncv.is_vector_of_sets = False
 *       return ncv
 */
  __pyx_t_5 = PyInt_FromLong(__pyx_v_iv->start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__offset, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":342
 *       # TODO: Test whether offset works properly
 *       ncv.offset = iv.start
 *       ncv.is_vector_of_sets = False             # <<<<<<<<<<<<<<
 *       return ncv
 * 
 */
  __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(__pyx_v_ncv, __pyx_n_s__is_vector_of_sets, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":343
 *       ncv.offset = iv.start
 *       ncv.is_vector_of_sets = False
 *       return ncv             # <<<<<<<<<<<<<<
 * 
 *    @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ncv);
  __pyx_r = __pyx_v_ncv;
  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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.create", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ncv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":346
 * 
 *    @classmethod
 *    def _create_view( cls, ChromVector vec, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       if iv.length == 0:
 *          raise IndexError, "Cannot subset to zero-length interval."
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_1_create_view(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_1_create_view(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *__pyx_v_vec = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv = 0;
  PyObject *__pyx_v_v = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vec,&__pyx_n_s__iv,0};
  __Pyx_RefNannySetupContext("_create_view");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vec);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iv);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_create_view", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_create_view") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_vec = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)values[0]);
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_create_view", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector._create_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vec), __pyx_ptype_5HTSeq_6_HTSeq_ChromVector, 1, "vec", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":347
 *    @classmethod
 *    def _create_view( cls, ChromVector vec, GenomicInterval iv ):
 *       if iv.length == 0:             # <<<<<<<<<<<<<<
 *          raise IndexError, "Cannot subset to zero-length interval."
 *       v = cls()
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":348
 *    def _create_view( cls, ChromVector vec, GenomicInterval iv ):
 *       if iv.length == 0:
 *          raise IndexError, "Cannot subset to zero-length interval."             # <<<<<<<<<<<<<<
 *       v = cls()
 *       v.iv = iv
 */
    __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_18), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":349
 *       if iv.length == 0:
 *          raise IndexError, "Cannot subset to zero-length interval."
 *       v = cls()             # <<<<<<<<<<<<<<
 *       v.iv = iv
 *       v.array = vec.array
 */
  __pyx_t_2 = PyObject_Call(__pyx_v_cls, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_v = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":350
 *          raise IndexError, "Cannot subset to zero-length interval."
 *       v = cls()
 *       v.iv = iv             # <<<<<<<<<<<<<<
 *       v.array = vec.array
 *       v.offset = vec.offset
 */
  if (PyObject_SetAttr(__pyx_v_v, __pyx_n_s__iv, ((PyObject *)__pyx_v_iv)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":351
 *       v = cls()
 *       v.iv = iv
 *       v.array = vec.array             # <<<<<<<<<<<<<<
 *       v.offset = vec.offset
 *       v.is_vector_of_sets = vec.is_vector_of_sets
 */
  if (PyObject_SetAttr(__pyx_v_v, __pyx_n_s__array, __pyx_v_vec->array) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":352
 *       v.iv = iv
 *       v.array = vec.array
 *       v.offset = vec.offset             # <<<<<<<<<<<<<<
 *       v.is_vector_of_sets = vec.is_vector_of_sets
 *       v._storage = vec._storage
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_vec->offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_v_v, __pyx_n_s__offset, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":353
 *       v.array = vec.array
 *       v.offset = vec.offset
 *       v.is_vector_of_sets = vec.is_vector_of_sets             # <<<<<<<<<<<<<<
 *       v._storage = vec._storage
 *       return v
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_vec->is_vector_of_sets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_v_v, __pyx_n_s__is_vector_of_sets, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":354
 *       v.offset = vec.offset
 *       v.is_vector_of_sets = vec.is_vector_of_sets
 *       v._storage = vec._storage             # <<<<<<<<<<<<<<
 *       return v
 * 
 */
  if (PyObject_SetAttr(__pyx_v_v, __pyx_n_s___storage, ((PyObject *)__pyx_v_vec->_storage)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":355
 *       v.is_vector_of_sets = vec.is_vector_of_sets
 *       v._storage = vec._storage
 *       return v             # <<<<<<<<<<<<<<
 * 
 *    def __getitem__( self, index ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_v);
  __pyx_r = __pyx_v_v;
  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("HTSeq._HTSeq.ChromVector._create_view", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":357
 *       return v
 * 
 *    def __getitem__( self, index ):             # <<<<<<<<<<<<<<
 *       cdef slice index_slice
 *       cdef long int index_int
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_index_slice = 0;
  long __pyx_v_index_int;
  long __pyx_v_start;
  long __pyx_v_stop;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  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("__getitem__");

  /* "HTSeq/_HTSeq.pyx":362
 *       cdef long int start, stop
 *       cdef GenomicInterval iv
 *       if isinstance( index, int ):             # <<<<<<<<<<<<<<
 *          index_int = index
 *          if index_int < self.iv.start or index_int >= self.iv.end:
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyInt_Type)));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":363
 *       cdef GenomicInterval iv
 *       if isinstance( index, int ):
 *          index_int = index             # <<<<<<<<<<<<<<
 *          if index_int < self.iv.start or index_int >= self.iv.end:
 *             raise IndexError
 */
    __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_v_index); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index_int = __pyx_t_3;

    /* "HTSeq/_HTSeq.pyx":364
 *       if isinstance( index, int ):
 *          index_int = index
 *          if index_int < self.iv.start or index_int >= self.iv.end:             # <<<<<<<<<<<<<<
 *             raise IndexError
 *          return self.array[ index_int - self.offset ]
 */
    __pyx_t_2 = (__pyx_v_index_int < ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start);
    if (!__pyx_t_2) {
      __pyx_t_4 = (__pyx_v_index_int >= ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_2;
    }
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":365
 *          index_int = index
 *          if index_int < self.iv.start or index_int >= self.iv.end:
 *             raise IndexError             # <<<<<<<<<<<<<<
 *          return self.array[ index_int - self.offset ]
 *       elif isinstance( index, slice ):
 */
      __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "HTSeq/_HTSeq.pyx":366
 *          if index_int < self.iv.start or index_int >= self.iv.end:
 *             raise IndexError
 *          return self.array[ index_int - self.offset ]             # <<<<<<<<<<<<<<
 *       elif isinstance( index, slice ):
 *          index_slice = index
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = (__pyx_v_index_int - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset);
    __pyx_t_1 = __Pyx_GetItemInt(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, __pyx_t_3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __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_L5;
  }

  /* "HTSeq/_HTSeq.pyx":367
 *             raise IndexError
 *          return self.array[ index_int - self.offset ]
 *       elif isinstance( index, slice ):             # <<<<<<<<<<<<<<
 *          index_slice = index
 *          if index_slice.start is not None:
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)(&PySlice_Type)));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":368
 *          return self.array[ index_int - self.offset ]
 *       elif isinstance( index, slice ):
 *          index_slice = index             # <<<<<<<<<<<<<<
 *          if index_slice.start is not None:
 *             start = index_slice.start
 */
    if (!(likely(PySlice_Check(__pyx_v_index))||((__pyx_v_index) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected slice, got %.200s", Py_TYPE(__pyx_v_index)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_index_slice = ((PyObject*)__pyx_v_index);

    /* "HTSeq/_HTSeq.pyx":369
 *       elif isinstance( index, slice ):
 *          index_slice = index
 *          if index_slice.start is not None:             # <<<<<<<<<<<<<<
 *             start = index_slice.start
 *             if start < self.iv.start:
 */
    __pyx_t_5 = (((PySliceObject*)__pyx_v_index_slice)->start != Py_None);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":370
 *          index_slice = index
 *          if index_slice.start is not None:
 *             start = index_slice.start             # <<<<<<<<<<<<<<
 *             if start < self.iv.start:
 *                raise IndexError, "start too small"
 */
      __pyx_t_3 = __Pyx_PyInt_AsLong(((PySliceObject*)__pyx_v_index_slice)->start); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_start = __pyx_t_3;

      /* "HTSeq/_HTSeq.pyx":371
 *          if index_slice.start is not None:
 *             start = index_slice.start
 *             if start < self.iv.start:             # <<<<<<<<<<<<<<
 *                raise IndexError, "start too small"
 *          else:
 */
      __pyx_t_5 = (__pyx_v_start < ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start);
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":372
 *             start = index_slice.start
 *             if start < self.iv.start:
 *                raise IndexError, "start too small"             # <<<<<<<<<<<<<<
 *          else:
 *             start = self.iv.start
 */
        __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_19), 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":374
 *                raise IndexError, "start too small"
 *          else:
 *             start = self.iv.start             # <<<<<<<<<<<<<<
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop
 */
      __pyx_v_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start;
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":375
 *          else:
 *             start = self.iv.start
 *          if index_slice.stop is not None:             # <<<<<<<<<<<<<<
 *             stop = index_slice.stop
 *             if stop > self.iv.end:
 */
    __pyx_t_5 = (((PySliceObject*)__pyx_v_index_slice)->stop != Py_None);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":376
 *             start = self.iv.start
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop             # <<<<<<<<<<<<<<
 *             if stop > self.iv.end:
 *                raise IndexError, "stop too large"
 */
      __pyx_t_3 = __Pyx_PyInt_AsLong(((PySliceObject*)__pyx_v_index_slice)->stop); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_stop = __pyx_t_3;

      /* "HTSeq/_HTSeq.pyx":377
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop
 *             if stop > self.iv.end:             # <<<<<<<<<<<<<<
 *                raise IndexError, "stop too large"
 *          else:
 */
      __pyx_t_5 = (__pyx_v_stop > ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end);
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":378
 *             stop = index_slice.stop
 *             if stop > self.iv.end:
 *                raise IndexError, "stop too large"             # <<<<<<<<<<<<<<
 *          else:
 *             stop = self.iv.end
 */
        __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_20), 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":380
 *                raise IndexError, "stop too large"
 *          else:
 *             stop = self.iv.end             # <<<<<<<<<<<<<<
 *          iv = GenomicInterval( self.iv.chrom, start, stop, self.iv.strand )
 *          if not self.iv.contains( iv ):
 */
      __pyx_v_stop = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end;
    }
    __pyx_L9:;

    /* "HTSeq/_HTSeq.pyx":381
 *          else:
 *             stop = self.iv.end
 *          iv = GenomicInterval( self.iv.chrom, start, stop, self.iv.strand )             # <<<<<<<<<<<<<<
 *          if not self.iv.contains( iv ):
 *             raise IndexError
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_stop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->chrom));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->chrom));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->chrom));
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_1 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "HTSeq/_HTSeq.pyx":382
 *             stop = self.iv.end
 *          iv = GenomicInterval( self.iv.chrom, start, stop, self.iv.strand )
 *          if not self.iv.contains( iv ):             # <<<<<<<<<<<<<<
 *             raise IndexError
 *          return ChromVector._create_view( self, iv )
 */
    __pyx_t_7 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->__pyx_vtab)->contains(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv, __pyx_v_iv, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_2 = (!__pyx_t_5);
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":383
 *          iv = GenomicInterval( self.iv.chrom, start, stop, self.iv.strand )
 *          if not self.iv.contains( iv ):
 *             raise IndexError             # <<<<<<<<<<<<<<
 *          return ChromVector._create_view( self, iv )
 *       elif isinstance( index, GenomicInterval ):
 */
      __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "HTSeq/_HTSeq.pyx":384
 *          if not self.iv.contains( iv ):
 *             raise IndexError
 *          return ChromVector._create_view( self, iv )             # <<<<<<<<<<<<<<
 *       elif isinstance( index, GenomicInterval ):
 *          if not self.iv.contains( index ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), __pyx_n_s___create_view); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(((PyObject *)__pyx_v_iv));
    PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_iv));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
    __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":385
 *             raise IndexError
 *          return ChromVector._create_view( self, iv )
 *       elif isinstance( index, GenomicInterval ):             # <<<<<<<<<<<<<<
 *          if not self.iv.contains( index ):
 *             raise IndexError
 */
  __pyx_t_6 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval));
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_6); 
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":386
 *          return ChromVector._create_view( self, iv )
 *       elif isinstance( index, GenomicInterval ):
 *          if not self.iv.contains( index ):             # <<<<<<<<<<<<<<
 *             raise IndexError
 *          if self.iv.strand is strand_nostrand and \
 */
    if (!(likely(((__pyx_v_index) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_index, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_v_index;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_8 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->__pyx_vtab)->contains(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv, ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_6), 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = (!__pyx_t_2);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":387
 *       elif isinstance( index, GenomicInterval ):
 *          if not self.iv.contains( index ):
 *             raise IndexError             # <<<<<<<<<<<<<<
 *          if self.iv.strand is strand_nostrand and \
 *                index.strand is not strand_nostrand:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "HTSeq/_HTSeq.pyx":388
 *          if not self.iv.contains( index ):
 *             raise IndexError
 *          if self.iv.strand is strand_nostrand and \             # <<<<<<<<<<<<<<
 *                index.strand is not strand_nostrand:
 *             iv = index.copy()   # Is this correct now?
 */
    __pyx_t_8 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = (__pyx_t_8 == ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":389
 *             raise IndexError
 *          if self.iv.strand is strand_nostrand and \
 *                index.strand is not strand_nostrand:             # <<<<<<<<<<<<<<
 *             iv = index.copy()   # Is this correct now?
 *             iv.strand = strand_nostrand
 */
      __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = (__pyx_t_8 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = __pyx_t_5;
    }
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":390
 *          if self.iv.strand is strand_nostrand and \
 *                index.strand is not strand_nostrand:
 *             iv = index.copy()   # Is this correct now?             # <<<<<<<<<<<<<<
 *             iv.strand = strand_nostrand
 *          return ChromVector._create_view( self, iv )
 */
      __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__copy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "HTSeq/_HTSeq.pyx":391
 *                index.strand is not strand_nostrand:
 *             iv = index.copy()   # Is this correct now?
 *             iv.strand = strand_nostrand             # <<<<<<<<<<<<<<
 *          return ChromVector._create_view( self, iv )
 *       else:
 */
      if (PyObject_SetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "HTSeq/_HTSeq.pyx":392
 *             iv = index.copy()   # Is this correct now?
 *             iv.strand = strand_nostrand
 *          return ChromVector._create_view( self, iv )             # <<<<<<<<<<<<<<
 *       else:
 *          raise TypeError, "Illegal index type"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), __pyx_n_s___create_view); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(!__pyx_v_iv)) { __Pyx_RaiseUnboundLocalError("iv"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(((PyObject *)__pyx_v_iv));
    PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_iv));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":394
 *          return ChromVector._create_view( self, iv )
 *       else:
 *          raise TypeError, "Illegal index type"             # <<<<<<<<<<<<<<
 * 
 *    def __setitem__( self, index, value ):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_21), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index_slice);
  __Pyx_XDECREF((PyObject *)__pyx_v_iv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":396
 *          raise TypeError, "Illegal index type"
 * 
 *    def __setitem__( self, index, value ):             # <<<<<<<<<<<<<<
 *       cdef slice index_slice
 *       cdef long int start, stop
 */

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_3__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_index_slice = 0;
  long __pyx_v_start;
  long __pyx_v_stop;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__");

  /* "HTSeq/_HTSeq.pyx":399
 *       cdef slice index_slice
 *       cdef long int start, stop
 *       if isinstance( value, ChromVector ):             # <<<<<<<<<<<<<<
 *          if self.array is value.array and value.iv.start == index.start and \
 *                value.iv.end == index.stop and ( index.step is None or index.step == 1 ):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":400
 *       cdef long int start, stop
 *       if isinstance( value, ChromVector ):
 *          if self.array is value.array and value.iv.start == index.start and \             # <<<<<<<<<<<<<<
 *                value.iv.end == index.stop and ( index.step is None or index.step == 1 ):
 *             return
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = (((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array == __pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__iv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __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_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":401
 *       if isinstance( value, ChromVector ):
 *          if self.array is value.array and value.iv.start == index.start and \
 *                value.iv.end == index.stop and ( index.step is None or index.step == 1 ):             # <<<<<<<<<<<<<<
 *             return
 *          else:
 */
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__iv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __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_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_6) {
          __pyx_t_3 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = (__pyx_t_3 == Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (!__pyx_t_7) {
            __pyx_t_3 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __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_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_9 = __pyx_t_8;
          } else {
            __pyx_t_9 = __pyx_t_7;
          }
          __pyx_t_7 = __pyx_t_9;
        } else {
          __pyx_t_7 = __pyx_t_6;
        }
        __pyx_t_6 = __pyx_t_7;
      } else {
        __pyx_t_6 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_6;
    } else {
      __pyx_t_5 = __pyx_t_2;
    }
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":402
 *          if self.array is value.array and value.iv.start == index.start and \
 *                value.iv.end == index.stop and ( index.step is None or index.step == 1 ):
 *             return             # <<<<<<<<<<<<<<
 *          else:
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":404
 *             return
 *          else:
 *             raise NotImplementedError, "Required assignment signature not yet implemented."             # <<<<<<<<<<<<<<
 *       if isinstance( index, int ):
 *          self.array[ index - self.iv.start ] = value
 */
      __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_kp_s_22), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":405
 *          else:
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 *       if isinstance( index, int ):             # <<<<<<<<<<<<<<
 *          self.array[ index - self.iv.start ] = value
 *       elif isinstance( index, slice ):
 */
  __pyx_t_4 = ((PyObject *)((PyObject*)(&PyInt_Type)));
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":406
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 *       if isinstance( index, int ):
 *          self.array[ index - self.iv.start ] = value             # <<<<<<<<<<<<<<
 *       elif isinstance( index, slice ):
 *          index_slice = index
 */
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_index, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyObject_SetItem(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, __pyx_t_3, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7;
  }

  /* "HTSeq/_HTSeq.pyx":407
 *       if isinstance( index, int ):
 *          self.array[ index - self.iv.start ] = value
 *       elif isinstance( index, slice ):             # <<<<<<<<<<<<<<
 *          index_slice = index
 *          if index_slice.start is not None:
 */
  __pyx_t_3 = ((PyObject *)((PyObject*)(&PySlice_Type)));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":408
 *          self.array[ index - self.iv.start ] = value
 *       elif isinstance( index, slice ):
 *          index_slice = index             # <<<<<<<<<<<<<<
 *          if index_slice.start is not None:
 *             start = index_slice.start
 */
    if (!(likely(PySlice_Check(__pyx_v_index))||((__pyx_v_index) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected slice, got %.200s", Py_TYPE(__pyx_v_index)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_index_slice = ((PyObject*)__pyx_v_index);

    /* "HTSeq/_HTSeq.pyx":409
 *       elif isinstance( index, slice ):
 *          index_slice = index
 *          if index_slice.start is not None:             # <<<<<<<<<<<<<<
 *             start = index_slice.start
 *             if start < self.iv.start:
 */
    __pyx_t_5 = (((PySliceObject*)__pyx_v_index_slice)->start != Py_None);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":410
 *          index_slice = index
 *          if index_slice.start is not None:
 *             start = index_slice.start             # <<<<<<<<<<<<<<
 *             if start < self.iv.start:
 *                raise IndexError, "start too small"
 */
      __pyx_t_10 = __Pyx_PyInt_AsLong(((PySliceObject*)__pyx_v_index_slice)->start); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_start = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":411
 *          if index_slice.start is not None:
 *             start = index_slice.start
 *             if start < self.iv.start:             # <<<<<<<<<<<<<<
 *                raise IndexError, "start too small"
 *          else:
 */
      __pyx_t_5 = (__pyx_v_start < ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start);
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":412
 *             start = index_slice.start
 *             if start < self.iv.start:
 *                raise IndexError, "start too small"             # <<<<<<<<<<<<<<
 *          else:
 *             start = self.iv.start
 */
        __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_19), 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":414
 *                raise IndexError, "start too small"
 *          else:
 *             start = self.iv.start             # <<<<<<<<<<<<<<
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop
 */
      __pyx_v_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start;
    }
    __pyx_L8:;

    /* "HTSeq/_HTSeq.pyx":415
 *          else:
 *             start = self.iv.start
 *          if index_slice.stop is not None:             # <<<<<<<<<<<<<<
 *             stop = index_slice.stop
 *             if stop > self.iv.end:
 */
    __pyx_t_5 = (((PySliceObject*)__pyx_v_index_slice)->stop != Py_None);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":416
 *             start = self.iv.start
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop             # <<<<<<<<<<<<<<
 *             if stop > self.iv.end:
 *                raise IndexError, "stop too large"
 */
      __pyx_t_10 = __Pyx_PyInt_AsLong(((PySliceObject*)__pyx_v_index_slice)->stop); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_stop = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":417
 *          if index_slice.stop is not None:
 *             stop = index_slice.stop
 *             if stop > self.iv.end:             # <<<<<<<<<<<<<<
 *                raise IndexError, "stop too large"
 *          else:
 */
      __pyx_t_5 = (__pyx_v_stop > ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end);
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":418
 *             stop = index_slice.stop
 *             if stop > self.iv.end:
 *                raise IndexError, "stop too large"             # <<<<<<<<<<<<<<
 *          else:
 *             stop = self.iv.end
 */
        __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_20), 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L11;
      }
      __pyx_L11:;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":420
 *                raise IndexError, "stop too large"
 *          else:
 *             stop = self.iv.end             # <<<<<<<<<<<<<<
 *          if start > stop:
 *             raise IndexError, "Start of interval is after its end."
 */
      __pyx_v_stop = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end;
    }
    __pyx_L10:;

    /* "HTSeq/_HTSeq.pyx":421
 *          else:
 *             stop = self.iv.end
 *          if start > stop:             # <<<<<<<<<<<<<<
 *             raise IndexError, "Start of interval is after its end."
 *          if start == stop:
 */
    __pyx_t_5 = (__pyx_v_start > __pyx_v_stop);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":422
 *             stop = self.iv.end
 *          if start > stop:
 *             raise IndexError, "Start of interval is after its end."             # <<<<<<<<<<<<<<
 *          if start == stop:
 *             raise IndexError, "Cannot assign to zero-length interval."
 */
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_23), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "HTSeq/_HTSeq.pyx":423
 *          if start > stop:
 *             raise IndexError, "Start of interval is after its end."
 *          if start == stop:             # <<<<<<<<<<<<<<
 *             raise IndexError, "Cannot assign to zero-length interval."
 *          self.array[ start - self.offset : stop - self.iv.start : index.step ] = value
 */
    __pyx_t_5 = (__pyx_v_start == __pyx_v_stop);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":424
 *             raise IndexError, "Start of interval is after its end."
 *          if start == stop:
 *             raise IndexError, "Cannot assign to zero-length interval."             # <<<<<<<<<<<<<<
 *          self.array[ start - self.offset : stop - self.iv.start : index.step ] = value
 *       elif isinstance( index, GenomicInterval ):
 */
      __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_kp_s_24), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "HTSeq/_HTSeq.pyx":425
 *          if start == stop:
 *             raise IndexError, "Cannot assign to zero-length interval."
 *          self.array[ start - self.offset : stop - self.iv.start : index.step ] = value             # <<<<<<<<<<<<<<
 *       elif isinstance( index, GenomicInterval ):
 *          if index.chrom != self.iv.chrom:
 */
    __pyx_t_3 = PyInt_FromLong((__pyx_v_start - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong((__pyx_v_stop - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = PySlice_New(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyObject_SetItem(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, __pyx_t_11, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L7;
  }

  /* "HTSeq/_HTSeq.pyx":426
 *             raise IndexError, "Cannot assign to zero-length interval."
 *          self.array[ start - self.offset : stop - self.iv.start : index.step ] = value
 *       elif isinstance( index, GenomicInterval ):             # <<<<<<<<<<<<<<
 *          if index.chrom != self.iv.chrom:
 *             raise KeyError, "Chromosome name mismatch."
 */
  __pyx_t_11 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval));
  __Pyx_INCREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_11); 
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":427
 *          self.array[ start - self.offset : stop - self.iv.start : index.step ] = value
 *       elif isinstance( index, GenomicInterval ):
 *          if index.chrom != self.iv.chrom:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Chromosome name mismatch."
 *          if self.iv.strand is not strand_nostrand and \
 */
    __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_11, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->chrom), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":428
 *       elif isinstance( index, GenomicInterval ):
 *          if index.chrom != self.iv.chrom:
 *             raise KeyError, "Chromosome name mismatch."             # <<<<<<<<<<<<<<
 *          if self.iv.strand is not strand_nostrand and \
 *                self.iv.strand is not self.index.strand:
 */
      __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_s_25), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "HTSeq/_HTSeq.pyx":429
 *          if index.chrom != self.iv.chrom:
 *             raise KeyError, "Chromosome name mismatch."
 *          if self.iv.strand is not strand_nostrand and \             # <<<<<<<<<<<<<<
 *                self.iv.strand is not self.index.strand:
 *             raise KeyError, "Strand mismatch."
 */
    __pyx_t_11 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_5 = (__pyx_t_11 != ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":430
 *             raise KeyError, "Chromosome name mismatch."
 *          if self.iv.strand is not strand_nostrand and \
 *                self.iv.strand is not self.index.strand:             # <<<<<<<<<<<<<<
 *             raise KeyError, "Strand mismatch."
 *          self.array[ index.iv.start - self.iv.start,
 */
      __pyx_t_11 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__index); 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_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strand); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = (__pyx_t_11 != __pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_2;
    } else {
      __pyx_t_6 = __pyx_t_5;
    }
    if (__pyx_t_6) {

      /* "HTSeq/_HTSeq.pyx":431
 *          if self.iv.strand is not strand_nostrand and \
 *                self.iv.strand is not self.index.strand:
 *             raise KeyError, "Strand mismatch."             # <<<<<<<<<<<<<<
 *          self.array[ index.iv.start - self.iv.start,
 *             index.iv.end - self.iv.start ] = value
 */
      __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_s_26), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "HTSeq/_HTSeq.pyx":432
 *                self.iv.strand is not self.index.strand:
 *             raise KeyError, "Strand mismatch."
 *          self.array[ index.iv.start - self.iv.start,             # <<<<<<<<<<<<<<
 *             index.iv.end - self.iv.start ] = value
 *       else:
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__iv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__start); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":433
 *             raise KeyError, "Strand mismatch."
 *          self.array[ index.iv.start - self.iv.start,
 *             index.iv.end - self.iv.start ] = value             # <<<<<<<<<<<<<<
 *       else:
 *          raise TypeError, "Illegal index type"
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__iv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__end); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __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 = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    if (PyObject_SetItem(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, ((PyObject *)__pyx_t_4), __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":435
 *             index.iv.end - self.iv.start ] = value
 *       else:
 *          raise TypeError, "Illegal index type"             # <<<<<<<<<<<<<<
 * 
 *    def __iadd__( self, value ):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_21), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  __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_11);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index_slice);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":441
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )
 *       else:
 *          def addval( x ):             # <<<<<<<<<<<<<<
 *             y = x.copy()
 *             y.add( value )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8__iadd___addval(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_5HTSeq_6_HTSeq_8__iadd___addval = {__Pyx_NAMESTR("addval"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8__iadd___addval, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8__iadd___addval(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *__pyx_cur_scope;
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *__pyx_outer_scope;
  PyObject *__pyx_v_y = NULL;
  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("addval");
  __pyx_outer_scope = (struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)__pyx_self;
  __pyx_cur_scope = __pyx_outer_scope;
  __pyx_self = __pyx_self;

  /* "HTSeq/_HTSeq.pyx":442
 *       else:
 *          def addval( x ):
 *             y = x.copy()             # <<<<<<<<<<<<<<
 *             y.add( value )
 *             return y
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __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 = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":443
 *          def addval( x ):
 *             y = x.copy()
 *             y.add( value )             # <<<<<<<<<<<<<<
 *             return y
 *          self.apply( addval )
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_value)) { __Pyx_RaiseClosureNameError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_value);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
  __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 = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":444
 *             y = x.copy()
 *             y.add( value )
 *             return y             # <<<<<<<<<<<<<<
 *          self.apply( addval )
 *       return self
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_y);
  __pyx_r = __pyx_v_y;
  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("HTSeq._HTSeq.__iadd__.addval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":437
 *          raise TypeError, "Illegal index type"
 * 
 *    def __iadd__( self, value ):             # <<<<<<<<<<<<<<
 *       if not self.is_vector_of_sets:
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_4__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_4__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *__pyx_cur_scope;
  PyObject *__pyx_v_addval = 0;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iadd__");
  __pyx_cur_scope = (struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)__pyx_ptype_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__->tp_new(__pyx_ptype_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_cur_scope->__pyx_v_value = __pyx_v_value;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);

  /* "HTSeq/_HTSeq.pyx":438
 * 
 *    def __iadd__( self, value ):
 *       if not self.is_vector_of_sets:             # <<<<<<<<<<<<<<
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )
 *       else:
 */
  __pyx_t_1 = (!((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->is_vector_of_sets);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":439
 *    def __iadd__( self, value ):
 *       if not self.is_vector_of_sets:
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )             # <<<<<<<<<<<<<<
 *       else:
 *          def addval( x ):
 */
    __pyx_t_2 = __Pyx_PySequence_GetSlice(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, (((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset), (((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____iadd__); 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_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 = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_value);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), 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;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":441
 *          self.array[ self.iv.start - self.offset : self.iv.end - self.offset ].__iadd__( value )
 *       else:
 *          def addval( x ):             # <<<<<<<<<<<<<<
 *             y = x.copy()
 *             y.add( value )
 */
    __pyx_t_4 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5HTSeq_6_HTSeq_8__iadd___addval, ((PyObject*)__pyx_cur_scope), __pyx_n_s_27); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF(__pyx_v_addval);
    __pyx_v_addval = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":445
 *             y.add( value )
 *             return y
 *          self.apply( addval )             # <<<<<<<<<<<<<<
 *       return self
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__apply); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_addval);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_addval);
    __Pyx_GIVEREF(__pyx_v_addval);
    __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 = 445; __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;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":446
 *             return y
 *          self.apply( addval )
 *       return self             # <<<<<<<<<<<<<<
 * 
 *    def __iter__( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.__iadd__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_addval);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":448
 *       return self
 * 
 *    def __iter__( self ):             # <<<<<<<<<<<<<<
 *       return self.values()
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5__iter__(PyObject *__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("__iter__");

  /* "HTSeq/_HTSeq.pyx":449
 * 
 *    def __iter__( self ):
 *       return self.values()             # <<<<<<<<<<<<<<
 * 
 *    def values( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":451
 *       return self.values()
 * 
 *    def values( self ):             # <<<<<<<<<<<<<<
 *       return iter( self.array[ self.iv.start - self.offset : self.iv.end - self.offset ] )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6values(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("values");

  /* "HTSeq/_HTSeq.pyx":452
 * 
 *    def values( self ):
 *       return iter( self.array[ self.iv.start - self.offset : self.iv.end - self.offset ] )             # <<<<<<<<<<<<<<
 * 
 *    def steps( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, (((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->start - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset), (((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv->end - ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":454
 *       return iter( self.array[ self.iv.start - self.offset : self.iv.end - self.offset ] )
 * 
 *    def steps( self ):             # <<<<<<<<<<<<<<
 *       return _HTSeq_internal.ChromVector_steps( self )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_7steps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_7steps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("steps");

  /* "HTSeq/_HTSeq.pyx":455
 * 
 *    def steps( self ):
 *       return _HTSeq_internal.ChromVector_steps( self )             # <<<<<<<<<<<<<<
 * 
 *    def apply( self, fun ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___HTSeq_internal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ChromVector_steps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __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 = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __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 = 455; __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_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("HTSeq._HTSeq.ChromVector.steps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":457
 *       return _HTSeq_internal.ChromVector_steps( self )
 * 
 *    def apply( self, fun ):             # <<<<<<<<<<<<<<
 *       for iv, value in self.steps():
 *          self.array[ iv.start - self.offset : iv.end - self.offset ] = fun( value )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8apply(PyObject *__pyx_v_self, PyObject *__pyx_v_fun); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8apply(PyObject *__pyx_v_self, PyObject *__pyx_v_fun) {
  PyObject *__pyx_v_iv = NULL;
  PyObject *__pyx_v_value = 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)(PyObject *);
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply");

  /* "HTSeq/_HTSeq.pyx":458
 * 
 *    def apply( self, fun ):
 *       for iv, value in self.steps():             # <<<<<<<<<<<<<<
 *          self.array[ iv.start - self.offset : iv.end - self.offset ] = fun( value )
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__steps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __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 = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_iv);
    __pyx_v_iv = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_value);
    __pyx_v_value = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "HTSeq/_HTSeq.pyx":459
 *    def apply( self, fun ):
 *       for iv, value in self.steps():
 *          self.array[ iv.start - self.offset : iv.end - self.offset ] = fun( value )             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    __pyx_t_6 = PyObject_Call(__pyx_v_fun, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (unlikely(!__pyx_v_iv)) { __Pyx_RaiseUnboundLocalError("iv"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_2 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyNumber_Subtract(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __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_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_v_iv)) { __Pyx_RaiseUnboundLocalError("iv"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_7 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __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_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PySequence_SetSlice(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array, __pyx_t_9, __pyx_t_10, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_iv);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":461
 *          self.array[ iv.start - self.offset : iv.end - self.offset ] = fun( value )
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       return "<%s object, %s, %s>" % ( self.__class__.__name__, str(self.iv), self._storage )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_9__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_9__repr__(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("__repr__");

  /* "HTSeq/_HTSeq.pyx":462
 * 
 *    def __repr__( self ):
 *       return "<%s object, %s, %s>" % ( self.__class__.__name__, str(self.iv), self._storage )             # <<<<<<<<<<<<<<
 * 
 *    def __reduce__( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __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 = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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("HTSeq._HTSeq.ChromVector.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":464
 *       return "<%s object, %s, %s>" % ( self.__class__.__name__, str(self.iv), self._storage )
 * 
 *    def __reduce__( self ):             # <<<<<<<<<<<<<<
 *       assert self.__class__ is ChromVector
 *       return( _ChromVector_unpickle,
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_10__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_10__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__");

  /* "HTSeq/_HTSeq.pyx":465
 * 
 *    def __reduce__( self ):
 *       assert self.__class__ is ChromVector             # <<<<<<<<<<<<<<
 *       return( _ChromVector_unpickle,
 *          ( self.array, self.iv, self.offset, self.is_vector_of_sets, self._storage ) )
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "HTSeq/_HTSeq.pyx":466
 *    def __reduce__( self ):
 *       assert self.__class__ is ChromVector
 *       return( _ChromVector_unpickle,             # <<<<<<<<<<<<<<
 *          ( self.array, self.iv, self.offset, self.is_vector_of_sets, self._storage ) )
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "HTSeq/_HTSeq.pyx":467
 *       assert self.__class__ is ChromVector
 *       return( _ChromVector_unpickle,
 *          ( self.array, self.iv, self.offset, self.is_vector_of_sets, self._storage ) )             # <<<<<<<<<<<<<<
 * 
 * def _ChromVector_unpickle( array, iv, offset, is_vector_of_sets, _storage ):
 */
  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->is_vector_of_sets); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  __Pyx_GIVEREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":316
 * cdef class ChromVector( object ):
 * 
 *    cdef public object array             # <<<<<<<<<<<<<<
 *    cdef public GenomicInterval iv
 *    cdef public int offset
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array;
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  __Pyx_DECREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  __Pyx_DECREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array);
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->array = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":317
 * 
 *    cdef public object array
 *    cdef public GenomicInterval iv             # <<<<<<<<<<<<<<
 *    cdef public int offset
 *    cdef public bint is_vector_of_sets
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.iv.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":318
 *    cdef public object array
 *    cdef public GenomicInterval iv
 *    cdef public int offset             # <<<<<<<<<<<<<<
 *    cdef public bint is_vector_of_sets
 *    cdef public str _storage
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset); 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_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("HTSeq._HTSeq.ChromVector.offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset_1__set__(PyObject *__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__");
  __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 = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->offset = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":319
 *    cdef public GenomicInterval iv
 *    cdef public int offset
 *    cdef public bint is_vector_of_sets             # <<<<<<<<<<<<<<
 *    cdef public str _storage
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->is_vector_of_sets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __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("HTSeq._HTSeq.ChromVector.is_vector_of_sets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->is_vector_of_sets = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector.is_vector_of_sets.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":320
 *    cdef public int offset
 *    cdef public bint is_vector_of_sets
 *    cdef public str _storage             # <<<<<<<<<<<<<<
 * 
 *    @classmethod
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.ChromVector._storage.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_v_self)->_storage = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":469
 *          ( self.array, self.iv, self.offset, self.is_vector_of_sets, self._storage ) )
 * 
 * def _ChromVector_unpickle( array, iv, offset, is_vector_of_sets, _storage ):             # <<<<<<<<<<<<<<
 *    cv = ChromVector()
 *    cv.array =  array
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_1_ChromVector_unpickle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5HTSeq_6_HTSeq_1_ChromVector_unpickle = {__Pyx_NAMESTR("_ChromVector_unpickle"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_1_ChromVector_unpickle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_1_ChromVector_unpickle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_array = 0;
  PyObject *__pyx_v_iv = 0;
  PyObject *__pyx_v_offset = 0;
  PyObject *__pyx_v_is_vector_of_sets = 0;
  PyObject *__pyx_v__storage = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *__pyx_v_cv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__array,&__pyx_n_s__iv,&__pyx_n_s__offset,&__pyx_n_s__is_vector_of_sets,&__pyx_n_s___storage,0};
  __Pyx_RefNannySetupContext("_ChromVector_unpickle");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__array);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iv);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_ChromVector_unpickle", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_ChromVector_unpickle", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__is_vector_of_sets);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_ChromVector_unpickle", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___storage);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_ChromVector_unpickle", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_ChromVector_unpickle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_array = values[0];
    __pyx_v_iv = values[1];
    __pyx_v_offset = values[2];
    __pyx_v_is_vector_of_sets = values[3];
    __pyx_v__storage = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_ChromVector_unpickle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq._ChromVector_unpickle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":470
 * 
 * def _ChromVector_unpickle( array, iv, offset, is_vector_of_sets, _storage ):
 *    cv = ChromVector()             # <<<<<<<<<<<<<<
 *    cv.array =  array
 *    cv.iv = iv
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cv = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":471
 * def _ChromVector_unpickle( array, iv, offset, is_vector_of_sets, _storage ):
 *    cv = ChromVector()
 *    cv.array =  array             # <<<<<<<<<<<<<<
 *    cv.iv = iv
 *    cv.offset = offset
 */
  __Pyx_INCREF(__pyx_v_array);
  __Pyx_GIVEREF(__pyx_v_array);
  __Pyx_GOTREF(__pyx_v_cv->array);
  __Pyx_DECREF(__pyx_v_cv->array);
  __pyx_v_cv->array = __pyx_v_array;

  /* "HTSeq/_HTSeq.pyx":472
 *    cv = ChromVector()
 *    cv.array =  array
 *    cv.iv = iv             # <<<<<<<<<<<<<<
 *    cv.offset = offset
 *    cv.is_vector_of_sets = is_vector_of_sets
 */
  if (!(likely(((__pyx_v_iv) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_iv, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_iv);
  __Pyx_GIVEREF(__pyx_v_iv);
  __Pyx_GOTREF(__pyx_v_cv->iv);
  __Pyx_DECREF(((PyObject *)__pyx_v_cv->iv));
  __pyx_v_cv->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv);

  /* "HTSeq/_HTSeq.pyx":473
 *    cv.array =  array
 *    cv.iv = iv
 *    cv.offset = offset             # <<<<<<<<<<<<<<
 *    cv.is_vector_of_sets = is_vector_of_sets
 *    cv._storage = _storage
 */
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_offset); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cv->offset = __pyx_t_2;

  /* "HTSeq/_HTSeq.pyx":474
 *    cv.iv = iv
 *    cv.offset = offset
 *    cv.is_vector_of_sets = is_vector_of_sets             # <<<<<<<<<<<<<<
 *    cv._storage = _storage
 *    return cv
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_vector_of_sets); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cv->is_vector_of_sets = __pyx_t_3;

  /* "HTSeq/_HTSeq.pyx":475
 *    cv.offset = offset
 *    cv.is_vector_of_sets = is_vector_of_sets
 *    cv._storage = _storage             # <<<<<<<<<<<<<<
 *    return cv
 * 
 */
  if (!(likely(PyString_CheckExact(__pyx_v__storage))||((__pyx_v__storage) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v__storage)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v__storage);
  __Pyx_GIVEREF(__pyx_v__storage);
  __Pyx_GOTREF(__pyx_v_cv->_storage);
  __Pyx_DECREF(((PyObject *)__pyx_v_cv->_storage));
  __pyx_v_cv->_storage = ((PyObject*)__pyx_v__storage);

  /* "HTSeq/_HTSeq.pyx":476
 *    cv.is_vector_of_sets = is_vector_of_sets
 *    cv._storage = _storage
 *    return cv             # <<<<<<<<<<<<<<
 * 
 * cdef class GenomicArray( object ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_cv));
  __pyx_r = ((PyObject *)__pyx_v_cv);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq._ChromVector_unpickle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_cv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":487
 *    cdef readonly str memmap_dir
 * 
 *    def __init__( self, object chroms, bint stranded=True, str typecode='d',             # <<<<<<<<<<<<<<
 *          str storage='step', str memmap_dir = "" ):
 *       self.chrom_vectors = {}
 */

static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chroms = 0;
  int __pyx_v_stranded;
  PyObject *__pyx_v_typecode = 0;
  PyObject *__pyx_v_storage = 0;
  PyObject *__pyx_v_memmap_dir = 0;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_c = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chroms,&__pyx_n_s__stranded,&__pyx_n_s__typecode,&__pyx_n_s__storage,&__pyx_n_s__memmap_dir,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject*)__pyx_n_s__d);
    values[3] = ((PyObject*)__pyx_n_s__step);
    values[4] = ((PyObject*)__pyx_kp_s_14);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chroms);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stranded);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__typecode);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__storage);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memmap_dir);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chroms = values[0];
    if (values[1]) {
      __pyx_v_stranded = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_stranded == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_stranded = ((int)1);
    }
    __pyx_v_typecode = ((PyObject*)values[2]);
    __pyx_v_storage = ((PyObject*)values[3]);
    __pyx_v_memmap_dir = ((PyObject*)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_chroms);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_typecode), (&PyString_Type), 1, "typecode", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_storage), (&PyString_Type), 1, "storage", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_memmap_dir), (&PyString_Type), 1, "memmap_dir", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":489
 *    def __init__( self, object chroms, bint stranded=True, str typecode='d',
 *          str storage='step', str memmap_dir = "" ):
 *       self.chrom_vectors = {}             # <<<<<<<<<<<<<<
 *       self.stranded = stranded
 *       self.typecode = typecode
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":490
 *          str storage='step', str memmap_dir = "" ):
 *       self.chrom_vectors = {}
 *       self.stranded = stranded             # <<<<<<<<<<<<<<
 *       self.typecode = typecode
 *       self.auto_add_chroms = chroms == "auto"
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded = __pyx_v_stranded;

  /* "HTSeq/_HTSeq.pyx":491
 *       self.chrom_vectors = {}
 *       self.stranded = stranded
 *       self.typecode = typecode             # <<<<<<<<<<<<<<
 *       self.auto_add_chroms = chroms == "auto"
 *       if self.auto_add_chroms:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_typecode));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_typecode));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode = __pyx_v_typecode;

  /* "HTSeq/_HTSeq.pyx":492
 *       self.stranded = stranded
 *       self.typecode = typecode
 *       self.auto_add_chroms = chroms == "auto"             # <<<<<<<<<<<<<<
 *       if self.auto_add_chroms:
 *          chroms = []
 */
  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_chroms, ((PyObject *)__pyx_n_s__auto), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms = __pyx_t_2;

  /* "HTSeq/_HTSeq.pyx":493
 *       self.typecode = typecode
 *       self.auto_add_chroms = chroms == "auto"
 *       if self.auto_add_chroms:             # <<<<<<<<<<<<<<
 *          chroms = []
 *          if storage != 'step':
 */
  if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms) {

    /* "HTSeq/_HTSeq.pyx":494
 *       self.auto_add_chroms = chroms == "auto"
 *       if self.auto_add_chroms:
 *          chroms = []             # <<<<<<<<<<<<<<
 *          if storage != 'step':
 *             raise TypeError, "Automatic adding of chromosomes can " + \
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(__pyx_v_chroms);
    __pyx_v_chroms = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "HTSeq/_HTSeq.pyx":495
 *       if self.auto_add_chroms:
 *          chroms = []
 *          if storage != 'step':             # <<<<<<<<<<<<<<
 *             raise TypeError, "Automatic adding of chromosomes can " + \
 *                " only be used with storage type 'StepVector'."
 */
    __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_storage), ((PyObject *)__pyx_n_s__step), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":496
 *          chroms = []
 *          if storage != 'step':
 *             raise TypeError, "Automatic adding of chromosomes can " + \             # <<<<<<<<<<<<<<
 *                " only be used with storage type 'StepVector'."
 *       elif isinstance( chroms, list ):
 */
      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }

  /* "HTSeq/_HTSeq.pyx":498
 *             raise TypeError, "Automatic adding of chromosomes can " + \
 *                " only be used with storage type 'StepVector'."
 *       elif isinstance( chroms, list ):             # <<<<<<<<<<<<<<
 *          if storage != 'step':
 *             raise TypeError, "Indefinite-length chromosomes can " + \
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyList_Type)));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_chroms, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":499
 *                " only be used with storage type 'StepVector'."
 *       elif isinstance( chroms, list ):
 *          if storage != 'step':             # <<<<<<<<<<<<<<
 *             raise TypeError, "Indefinite-length chromosomes can " + \
 *                " only be used with storage type 'StepVector'."
 */
    __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_storage), ((PyObject *)__pyx_n_s__step), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":500
 *       elif isinstance( chroms, list ):
 *          if storage != 'step':
 *             raise TypeError, "Indefinite-length chromosomes can " + \             # <<<<<<<<<<<<<<
 *                " only be used with storage type 'StepVector'."
 *          chroms = dict( [ ( c, sys.maxint ) for c in chroms ] )
 */
      __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "HTSeq/_HTSeq.pyx":502
 *             raise TypeError, "Indefinite-length chromosomes can " + \
 *                " only be used with storage type 'StepVector'."
 *          chroms = dict( [ ( c, sys.maxint ) for c in chroms ] )             # <<<<<<<<<<<<<<
 *       elif not isinstance( chroms, dict ):
 *          raise TypeError, "'chroms' must be a list or a dict or 'auto'."
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyList_CheckExact(__pyx_v_chroms) || PyTuple_CheckExact(__pyx_v_chroms)) {
      __pyx_t_3 = __pyx_v_chroms; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_chroms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else if (PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++;
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF(__pyx_v_c);
      __pyx_v_c = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__maxint); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(__pyx_v_c);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_c);
      __Pyx_GIVEREF(__pyx_v_c);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __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_v_chroms);
    __pyx_v_chroms = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }

  /* "HTSeq/_HTSeq.pyx":503
 *                " only be used with storage type 'StepVector'."
 *          chroms = dict( [ ( c, sys.maxint ) for c in chroms ] )
 *       elif not isinstance( chroms, dict ):             # <<<<<<<<<<<<<<
 *          raise TypeError, "'chroms' must be a list or a dict or 'auto'."
 *       self.storage = storage
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)(&PyDict_Type)));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_chroms, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (!__pyx_t_2);
  if (__pyx_t_8) {

    /* "HTSeq/_HTSeq.pyx":504
 *          chroms = dict( [ ( c, sys.maxint ) for c in chroms ] )
 *       elif not isinstance( chroms, dict ):
 *          raise TypeError, "'chroms' must be a list or a dict or 'auto'."             # <<<<<<<<<<<<<<
 *       self.storage = storage
 *       self.memmap_dir = memmap_dir
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_33), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":505
 *       elif not isinstance( chroms, dict ):
 *          raise TypeError, "'chroms' must be a list or a dict or 'auto'."
 *       self.storage = storage             # <<<<<<<<<<<<<<
 *       self.memmap_dir = memmap_dir
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_storage));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_storage));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage = __pyx_v_storage;

  /* "HTSeq/_HTSeq.pyx":506
 *          raise TypeError, "'chroms' must be a list or a dict or 'auto'."
 *       self.storage = storage
 *       self.memmap_dir = memmap_dir             # <<<<<<<<<<<<<<
 * 
 *       for chrom in chroms:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_memmap_dir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_memmap_dir));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir = __pyx_v_memmap_dir;

  /* "HTSeq/_HTSeq.pyx":508
 *       self.memmap_dir = memmap_dir
 * 
 *       for chrom in chroms:             # <<<<<<<<<<<<<<
 *          self.add_chrom( chrom, chroms[chrom] )
 * 
 */
  if (PyList_CheckExact(__pyx_v_chroms) || PyTuple_CheckExact(__pyx_v_chroms)) {
    __pyx_t_1 = __pyx_v_chroms; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_chroms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF(__pyx_v_chrom);
    __pyx_v_chrom = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "HTSeq/_HTSeq.pyx":509
 * 
 *       for chrom in chroms:
 *          self.add_chrom( chrom, chroms[chrom] )             # <<<<<<<<<<<<<<
 * 
 *    def __getitem__( self, index ):
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_chrom); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyObject_GetItem(__pyx_v_chroms, __pyx_v_chrom); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_INCREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_chroms);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":511
 *          self.add_chrom( chrom, chroms[chrom] )
 * 
 *    def __getitem__( self, index ):             # <<<<<<<<<<<<<<
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_1__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__");

  /* "HTSeq/_HTSeq.pyx":512
 * 
 *    def __getitem__( self, index ):
 *       if isinstance( index, GenomicInterval ):             # <<<<<<<<<<<<<<
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":513
 *    def __getitem__( self, index ):
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):             # <<<<<<<<<<<<<<
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 */
    if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (((int)__pyx_t_2)) {
        __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_4 = ((int)__pyx_t_3);
      } else {
        __pyx_t_4 = ((int)__pyx_t_2);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_4 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded;
    }
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":514
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."             # <<<<<<<<<<<<<<
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )
 */
      __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_s_34), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "HTSeq/_HTSeq.pyx":515
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:             # <<<<<<<<<<<<<<
 *             self.add_chrom( index.chrom )
 *          if isinstance( index, GenomicPosition ):
 */
    if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_4 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_1))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __pyx_t_4;
    } else {
      __pyx_t_2 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms;
    }
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":516
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )             # <<<<<<<<<<<<<<
 *          if isinstance( index, GenomicPosition ):
 *             if self.stranded:
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":517
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )
 *          if isinstance( index, GenomicPosition ):             # <<<<<<<<<<<<<<
 *             if self.stranded:
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.pos ]
 */
    __pyx_t_5 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition));
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_5); 
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":518
 *             self.add_chrom( index.chrom )
 *          if isinstance( index, GenomicPosition ):
 *             if self.stranded:             # <<<<<<<<<<<<<<
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.pos ]
 *             else:
 */
      if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {

        /* "HTSeq/_HTSeq.pyx":519
 *          if isinstance( index, GenomicPosition ):
 *             if self.stranded:
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.pos ]             # <<<<<<<<<<<<<<
 *             else:
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.pos ]
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_5); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_t_5); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_t_5); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
        goto __pyx_L9;
      }
      /*else*/ {

        /* "HTSeq/_HTSeq.pyx":521
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.pos ]
 *             else:
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.pos ]             # <<<<<<<<<<<<<<
 *          else:
 *             if self.stranded:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_6); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetItem(__pyx_t_5, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_t_5); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":523
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.pos ]
 *          else:
 *             if self.stranded:             # <<<<<<<<<<<<<<
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ]
 *             else:
 */
      if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {

        /* "HTSeq/_HTSeq.pyx":524
 *          else:
 *             if self.stranded:
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ]             # <<<<<<<<<<<<<<
 *             else:
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ]
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyObject_GetItem(__pyx_t_5, __pyx_t_1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __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 = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_t_6, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "HTSeq/_HTSeq.pyx":526
 *                return self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ]
 *             else:
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ]             # <<<<<<<<<<<<<<
 *       else:
 *          return self.chrom_vectors[ index ]
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetItem(__pyx_t_6, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PySequence_GetSlice(__pyx_t_1, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;
      }
      __pyx_L10:;
    }
    __pyx_L8:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":528
 *                return self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ]
 *       else:
 *          return self.chrom_vectors[ index ]             # <<<<<<<<<<<<<<
 * 
 *    def __setitem__( self, index, value ):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_index); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":530
 *          return self.chrom_vectors[ index ]
 * 
 *    def __setitem__( self, index, value ):             # <<<<<<<<<<<<<<
 *       cdef GenomicInterval index2
 *       if isinstance( value, ChromVector ):
 */

static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_2__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_2__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_index2 = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__");

  /* "HTSeq/_HTSeq.pyx":532
 *    def __setitem__( self, index, value ):
 *       cdef GenomicInterval index2
 *       if isinstance( value, ChromVector ):             # <<<<<<<<<<<<<<
 *          if not isinstance( index, GenomicInterval ):
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":533
 *       cdef GenomicInterval index2
 *       if isinstance( value, ChromVector ):
 *          if not isinstance( index, GenomicInterval ):             # <<<<<<<<<<<<<<
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 *          index2 = index.copy()
 */
    __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval));
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = (!__pyx_t_2);
    if (__pyx_t_3) {

      /* "HTSeq/_HTSeq.pyx":534
 *       if isinstance( value, ChromVector ):
 *          if not isinstance( index, GenomicInterval ):
 *             raise NotImplementedError, "Required assignment signature not yet implemented."             # <<<<<<<<<<<<<<
 *          index2 = index.copy()
 *          if not self.stranded:
 */
      __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_kp_s_22), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "HTSeq/_HTSeq.pyx":535
 *          if not isinstance( index, GenomicInterval ):
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 *          index2 = index.copy()             # <<<<<<<<<<<<<<
 *          if not self.stranded:
 *             index2.strand = strand_nostrand
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_index2 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":536
 *             raise NotImplementedError, "Required assignment signature not yet implemented."
 *          index2 = index.copy()
 *          if not self.stranded:             # <<<<<<<<<<<<<<
 *             index2.strand = strand_nostrand
 *          if self.chrom_vectors[ index2.chrom ][ index2.strand ].array is value.array and index2 == value.iv:
 */
    __pyx_t_3 = (!((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded);
    if (__pyx_t_3) {

      /* "HTSeq/_HTSeq.pyx":537
 *          index2 = index.copy()
 *          if not self.stranded:
 *             index2.strand = strand_nostrand             # <<<<<<<<<<<<<<
 *          if self.chrom_vectors[ index2.chrom ][ index2.strand ].array is value.array and index2 == value.iv:
 *             return
 */
      if (PyObject_SetAttr(((PyObject *)__pyx_v_index2), __pyx_n_s__strand, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":538
 *          if not self.stranded:
 *             index2.strand = strand_nostrand
 *          if self.chrom_vectors[ index2.chrom ][ index2.strand ].array is value.array and index2 == value.iv:             # <<<<<<<<<<<<<<
 *             return
 *          raise NotImplementedError, "Required assignment signature not yet implemented."
 */
    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), ((PyObject *)__pyx_v_index2->chrom)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_index2), __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = (__pyx_t_1 == __pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_value, __pyx_n_s__iv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_index2), __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __pyx_t_2;
    } else {
      __pyx_t_6 = __pyx_t_3;
    }
    if (__pyx_t_6) {

      /* "HTSeq/_HTSeq.pyx":539
 *             index2.strand = strand_nostrand
 *          if self.chrom_vectors[ index2.chrom ][ index2.strand ].array is value.array and index2 == value.iv:
 *             return             # <<<<<<<<<<<<<<
 *          raise NotImplementedError, "Required assignment signature not yet implemented."
 *       if isinstance( index, GenomicInterval ):
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "HTSeq/_HTSeq.pyx":540
 *          if self.chrom_vectors[ index2.chrom ][ index2.strand ].array is value.array and index2 == value.iv:
 *             return
 *          raise NotImplementedError, "Required assignment signature not yet implemented."             # <<<<<<<<<<<<<<
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_kp_s_22), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":541
 *             return
 *          raise NotImplementedError, "Required assignment signature not yet implemented."
 *       if isinstance( index, GenomicInterval ):             # <<<<<<<<<<<<<<
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_6) {

    /* "HTSeq/_HTSeq.pyx":542
 *          raise NotImplementedError, "Required assignment signature not yet implemented."
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):             # <<<<<<<<<<<<<<
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 */
    if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus), Py_NE); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (((int)__pyx_t_6)) {
        __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_2 = ((int)__pyx_t_3);
      } else {
        __pyx_t_2 = ((int)__pyx_t_6);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __pyx_t_2;
      __pyx_t_2 = __pyx_t_6;
    } else {
      __pyx_t_2 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded;
    }
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":543
 *       if isinstance( index, GenomicInterval ):
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."             # <<<<<<<<<<<<<<
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )
 */
      __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_kp_s_34), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "HTSeq/_HTSeq.pyx":544
 *          if self.stranded and index.strand not in ( strand_plus, strand_minus ):
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:             # <<<<<<<<<<<<<<
 *             self.add_chrom( index.chrom )
 *          if self.stranded:
 */
    if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_2 = (__Pyx_NegateNonNeg(PyDict_Contains(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_1))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __pyx_t_2;
    } else {
      __pyx_t_6 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms;
    }
    if (__pyx_t_6) {

      /* "HTSeq/_HTSeq.pyx":545
 *             raise KeyError, "Non-stranded index used for stranded GenomicArray."
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )             # <<<<<<<<<<<<<<
 *          if self.stranded:
 *             self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ] = value
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__add_chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "HTSeq/_HTSeq.pyx":546
 *          if self.auto_add_chroms and index.chrom not in self.chrom_vectors:
 *             self.add_chrom( index.chrom )
 *          if self.stranded:             # <<<<<<<<<<<<<<
 *             self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ] = value
 *          else:
 */
    if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {

      /* "HTSeq/_HTSeq.pyx":547
 *             self.add_chrom( index.chrom )
 *          if self.stranded:
 *             self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ] = value             # <<<<<<<<<<<<<<
 *          else:
 *             self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ] = value
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_5); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__strand); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __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_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__Pyx_PySequence_SetSlice(__pyx_t_1, __pyx_t_7, __pyx_t_8, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L12;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":549
 *             self.chrom_vectors[ index.chrom ][ index.strand ][ index.start : index.end ] = value
 *          else:
 *             self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ] = value             # <<<<<<<<<<<<<<
 *       else:
 *          raise TypeError, "Illegal index type."
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__chrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_t_1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetItem(__pyx_t_5, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__Pyx_PySequence_SetSlice(__pyx_t_1, __pyx_t_8, __pyx_t_7, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L12:;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":551
 *             self.chrom_vectors[ index.chrom ][ strand_nostrand ][ index.start : index.end ] = value
 *       else:
 *          raise TypeError, "Illegal index type."             # <<<<<<<<<<<<<<
 * 
 *    def add_chrom( self, chrom, length = sys.maxint, start_index = 0 ):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_35), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L9:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":553
 *          raise TypeError, "Illegal index type."
 * 
 *    def add_chrom( self, chrom, length = sys.maxint, start_index = 0 ):             # <<<<<<<<<<<<<<
 *       cdef GenomicInterval iv
 *       if length == sys.maxint:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_3add_chrom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_3add_chrom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_start_index = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__chrom,&__pyx_n_s__length,&__pyx_n_s__start_index,0};
  __Pyx_RefNannySetupContext("add_chrom");
  {
    PyObject* values[3] = {0,0,0};
    values[1] = __pyx_k_36;
    values[2] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_index);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_chrom") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chrom = values[0];
    __pyx_v_length = values[1];
    __pyx_v_start_index = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_chrom", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.add_chrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":555
 *    def add_chrom( self, chrom, length = sys.maxint, start_index = 0 ):
 *       cdef GenomicInterval iv
 *       if length == sys.maxint:             # <<<<<<<<<<<<<<
 *          iv = GenomicInterval( chrom, start_index, sys.maxint, "." )
 *       else:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__maxint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __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_RichCompare(__pyx_v_length, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":556
 *       cdef GenomicInterval iv
 *       if length == sys.maxint:
 *          iv = GenomicInterval( chrom, start_index, sys.maxint, "." )             # <<<<<<<<<<<<<<
 *       else:
 *          iv = GenomicInterval( chrom, start_index, start_index + length, "." )
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__maxint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __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(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_start_index);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start_index);
    __Pyx_GIVEREF(__pyx_v_start_index);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_kp_s_11));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":558
 *          iv = GenomicInterval( chrom, start_index, sys.maxint, "." )
 *       else:
 *          iv = GenomicInterval( chrom, start_index, start_index + length, "." )             # <<<<<<<<<<<<<<
 *       if self.stranded:
 *          self.chrom_vectors[ chrom ] = {}
 */
    __pyx_t_2 = PyNumber_Add(__pyx_v_start_index, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    __Pyx_INCREF(__pyx_v_start_index);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_start_index);
    __Pyx_GIVEREF(__pyx_v_start_index);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_kp_s_11));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":559
 *       else:
 *          iv = GenomicInterval( chrom, start_index, start_index + length, "." )
 *       if self.stranded:             # <<<<<<<<<<<<<<
 *          self.chrom_vectors[ chrom ] = {}
 *          iv.strand = "+"
 */
  if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {

    /* "HTSeq/_HTSeq.pyx":560
 *          iv = GenomicInterval( chrom, start_index, start_index + length, "." )
 *       if self.stranded:
 *          self.chrom_vectors[ chrom ] = {}             # <<<<<<<<<<<<<<
 *          iv.strand = "+"
 *          self.chrom_vectors[ chrom ][ strand_plus ] = \
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_chrom, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

    /* "HTSeq/_HTSeq.pyx":561
 *       if self.stranded:
 *          self.chrom_vectors[ chrom ] = {}
 *          iv.strand = "+"             # <<<<<<<<<<<<<<
 *          self.chrom_vectors[ chrom ][ strand_plus ] = \
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 */
    if (PyObject_SetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "HTSeq/_HTSeq.pyx":563
 *          iv.strand = "+"
 *          self.chrom_vectors[ chrom ][ strand_plus ] = \
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )             # <<<<<<<<<<<<<<
 *          iv = iv.copy()
 *          iv.strand = "-"
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), __pyx_n_s__create); if (unlikely(!__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_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_iv));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_iv));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

    /* "HTSeq/_HTSeq.pyx":562
 *          self.chrom_vectors[ chrom ] = {}
 *          iv.strand = "+"
 *          self.chrom_vectors[ chrom ][ strand_plus ] = \             # <<<<<<<<<<<<<<
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *          iv = iv.copy()
 */
    __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_chrom); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":564
 *          self.chrom_vectors[ chrom ][ strand_plus ] = \
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *          iv = iv.copy()             # <<<<<<<<<<<<<<
 *          iv.strand = "-"
 *          self.chrom_vectors[ chrom ][ strand_minus ] = \
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_iv));
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "HTSeq/_HTSeq.pyx":565
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *          iv = iv.copy()
 *          iv.strand = "-"             # <<<<<<<<<<<<<<
 *          self.chrom_vectors[ chrom ][ strand_minus ] = \
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 */
    if (PyObject_SetAttr(((PyObject *)__pyx_v_iv), __pyx_n_s__strand, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "HTSeq/_HTSeq.pyx":567
 *          iv.strand = "-"
 *          self.chrom_vectors[ chrom ][ strand_minus ] = \
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )             # <<<<<<<<<<<<<<
 *       else:
 *          self.chrom_vectors[ chrom ] = {
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), __pyx_n_s__create); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(((PyObject *)__pyx_v_iv));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_iv));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __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_4)); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":566
 *          iv = iv.copy()
 *          iv.strand = "-"
 *          self.chrom_vectors[ chrom ][ strand_minus ] = \             # <<<<<<<<<<<<<<
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *       else:
 */
    __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_chrom); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetItem(__pyx_t_4, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":569
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *       else:
 *          self.chrom_vectors[ chrom ] = {             # <<<<<<<<<<<<<<
 *             strand_nostrand:  ChromVector.create( iv, self.typecode, self.storage ) }
 * 
 */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));

    /* "HTSeq/_HTSeq.pyx":570
 *       else:
 *          self.chrom_vectors[ chrom ] = {
 *             strand_nostrand:  ChromVector.create( iv, self.typecode, self.storage ) }             # <<<<<<<<<<<<<<
 * 
 *    def __reduce__( self ):
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector)), __pyx_n_s__create); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)__pyx_v_iv));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_iv));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "HTSeq/_HTSeq.pyx":569
 *             ChromVector.create( iv, self.typecode, self.storage, self.memmap_dir )
 *       else:
 *          self.chrom_vectors[ chrom ] = {             # <<<<<<<<<<<<<<
 *             strand_nostrand:  ChromVector.create( iv, self.typecode, self.storage ) }
 * 
 */
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_chrom, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  }
  __pyx_L7:;

  __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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.add_chrom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_iv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":572
 *             strand_nostrand:  ChromVector.create( iv, self.typecode, self.storage ) }
 * 
 *    def __reduce__( self ):             # <<<<<<<<<<<<<<
 *       return ( _GenomicArray_unpickle, ( self.stranded, self.typecode, self.chrom_vectors ) )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_4__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_4__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("__reduce__");

  /* "HTSeq/_HTSeq.pyx":573
 * 
 *    def __reduce__( self ):
 *       return ( _GenomicArray_unpickle, ( self.stranded, self.typecode, self.chrom_vectors ) )             # <<<<<<<<<<<<<<
 * 
 *    def write_bedgraph_file( self, file_or_filename, strand=".", track_options="" ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_39); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __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 = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":575
 *       return ( _GenomicArray_unpickle, ( self.stranded, self.typecode, self.chrom_vectors ) )
 * 
 *    def write_bedgraph_file( self, file_or_filename, strand=".", track_options="" ):             # <<<<<<<<<<<<<<
 *       if ( not self.stranded ) and strand != ".":
 *          raise ValueError, "Strand specified in unstranded GenomicArray."
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_5write_bedgraph_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_5write_bedgraph_file(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_file_or_filename = 0;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_v_track_options = 0;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_iv = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file_or_filename,&__pyx_n_s__strand,&__pyx_n_s__track_options,0};
  __Pyx_RefNannySetupContext("write_bedgraph_file");
  {
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_kp_s_11);
    values[2] = ((PyObject *)__pyx_kp_s_14);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file_or_filename);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track_options);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "write_bedgraph_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_file_or_filename = values[0];
    __pyx_v_strand = values[1];
    __pyx_v_track_options = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write_bedgraph_file", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.write_bedgraph_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":576
 * 
 *    def write_bedgraph_file( self, file_or_filename, strand=".", track_options="" ):
 *       if ( not self.stranded ) and strand != ".":             # <<<<<<<<<<<<<<
 *          raise ValueError, "Strand specified in unstranded GenomicArray."
 *       if self.stranded and strand not in ( strand_plus, strand_minus ):
 */
  __pyx_t_1 = (!((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_strand, ((PyObject *)__pyx_kp_s_11), Py_NE); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":577
 *    def write_bedgraph_file( self, file_or_filename, strand=".", track_options="" ):
 *       if ( not self.stranded ) and strand != ".":
 *          raise ValueError, "Strand specified in unstranded GenomicArray."             # <<<<<<<<<<<<<<
 *       if self.stranded and strand not in ( strand_plus, strand_minus ):
 *          raise ValueError, "Strand must be specified for stranded GenomicArray."
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_40), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":578
 *       if ( not self.stranded ) and strand != ".":
 *          raise ValueError, "Strand specified in unstranded GenomicArray."
 *       if self.stranded and strand not in ( strand_plus, strand_minus ):             # <<<<<<<<<<<<<<
 *          raise ValueError, "Strand must be specified for stranded GenomicArray."
 *       if hasattr( file_or_filename, "write" ):
 */
  if (((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded) {
    __Pyx_INCREF(__pyx_v_strand);
    __pyx_t_4 = __pyx_v_strand;
    __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_4, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus), Py_NE); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (((int)__pyx_t_3)) {
      __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_4, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = ((int)__pyx_t_1);
    } else {
      __pyx_t_2 = ((int)__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded;
  }
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":579
 *          raise ValueError, "Strand specified in unstranded GenomicArray."
 *       if self.stranded and strand not in ( strand_plus, strand_minus ):
 *          raise ValueError, "Strand must be specified for stranded GenomicArray."             # <<<<<<<<<<<<<<
 *       if hasattr( file_or_filename, "write" ):
 *          f = file_or_filename
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_41), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "HTSeq/_HTSeq.pyx":580
 *       if self.stranded and strand not in ( strand_plus, strand_minus ):
 *          raise ValueError, "Strand must be specified for stranded GenomicArray."
 *       if hasattr( file_or_filename, "write" ):             # <<<<<<<<<<<<<<
 *          f = file_or_filename
 *       else:
 */
  __pyx_t_4 = ((PyObject *)__pyx_n_s__write);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_2 = PyObject_HasAttr(__pyx_v_file_or_filename, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":581
 *          raise ValueError, "Strand must be specified for stranded GenomicArray."
 *       if hasattr( file_or_filename, "write" ):
 *          f = file_or_filename             # <<<<<<<<<<<<<<
 *       else:
 *          f = open( file_or_filename, "w" )
 */
    __Pyx_INCREF(__pyx_v_file_or_filename);
    __pyx_v_f = __pyx_v_file_or_filename;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":583
 *          f = file_or_filename
 *       else:
 *          f = open( file_or_filename, "w" )             # <<<<<<<<<<<<<<
 *       if track_options == "":
 *          f.write( "track type=bedGraph\n" )
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_file_or_filename);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_file_or_filename);
    __Pyx_GIVEREF(__pyx_v_file_or_filename);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__w));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
    __pyx_t_5 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v_f = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L8:;

  /* "HTSeq/_HTSeq.pyx":584
 *       else:
 *          f = open( file_or_filename, "w" )
 *       if track_options == "":             # <<<<<<<<<<<<<<
 *          f.write( "track type=bedGraph\n" )
 *       else:
 */
  __pyx_t_2 = __Pyx_PyString_Equals(__pyx_v_track_options, ((PyObject *)__pyx_kp_s_14), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":585
 *          f = open( file_or_filename, "w" )
 *       if track_options == "":
 *          f.write( "track type=bedGraph\n" )             # <<<<<<<<<<<<<<
 *       else:
 *          f.write( "track type=bedGraph %s\n" % track_options )
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L9;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":587
 *          f.write( "track type=bedGraph\n" )
 *       else:
 *          f.write( "track type=bedGraph %s\n" % track_options )             # <<<<<<<<<<<<<<
 *       for chrom in self.chrom_vectors:
 *          for iv, value in self.chrom_vectors[ chrom ][ strand ].steps():
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_v_track_options); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L9:;

  /* "HTSeq/_HTSeq.pyx":588
 *       else:
 *          f.write( "track type=bedGraph %s\n" % track_options )
 *       for chrom in self.chrom_vectors:             # <<<<<<<<<<<<<<
 *          for iv, value in self.chrom_vectors[ chrom ][ strand ].steps():
 *             if iv.start == -sys.maxint-1 or iv.end == sys.maxint:
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  __Pyx_XDECREF(__pyx_t_5);
  __pyx_t_5 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors);
  __pyx_t_7 = 0;
  __pyx_t_8 = PyDict_Size(__pyx_t_5);
  while (1) {
    if (unlikely(__pyx_t_8 != PyDict_Size(__pyx_t_5))) {
      PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!PyDict_Next(__pyx_t_5, (&__pyx_t_7), (&__pyx_t_9), NULL)) break;
    __Pyx_INCREF(((PyObject *)__pyx_t_9));
    __Pyx_XDECREF(__pyx_v_chrom);
    __pyx_v_chrom = __pyx_t_9;

    /* "HTSeq/_HTSeq.pyx":589
 *          f.write( "track type=bedGraph %s\n" % track_options )
 *       for chrom in self.chrom_vectors:
 *          for iv, value in self.chrom_vectors[ chrom ][ strand ].steps():             # <<<<<<<<<<<<<<
 *             if iv.start == -sys.maxint-1 or iv.end == sys.maxint:
 *                continue
 */
    __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors), __pyx_v_chrom); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_6, __pyx_v_strand); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__steps); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_t_6)) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++;
      } else if (PyTuple_CheckExact(__pyx_t_6)) {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++;
      } else {
        __pyx_t_4 = __pyx_t_11(__pyx_t_6);
        if (unlikely(!__pyx_t_4)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
        index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L15_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_iv);
      __pyx_v_iv = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_v_value);
      __pyx_v_value = __pyx_t_13;
      __pyx_t_13 = 0;

      /* "HTSeq/_HTSeq.pyx":590
 *       for chrom in self.chrom_vectors:
 *          for iv, value in self.chrom_vectors[ chrom ][ strand ].steps():
 *             if iv.start == -sys.maxint-1 or iv.end == sys.maxint:             # <<<<<<<<<<<<<<
 *                continue
 *             f.write( "%s\t%d\t%d\t%f\n" % (iv.chrom, iv.start, iv.end, value) )
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__maxint); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyNumber_Negative(__pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_Subtract(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_RichCompare(__pyx_t_4, __pyx_t_12, Py_EQ); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (!__pyx_t_2) {
        __pyx_t_13 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__end); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_4 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__maxint); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_RichCompare(__pyx_t_13, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_1 = __pyx_t_3;
      } else {
        __pyx_t_1 = __pyx_t_2;
      }
      if (__pyx_t_1) {

        /* "HTSeq/_HTSeq.pyx":591
 *          for iv, value in self.chrom_vectors[ chrom ][ strand ].steps():
 *             if iv.start == -sys.maxint-1 or iv.end == sys.maxint:
 *                continue             # <<<<<<<<<<<<<<
 *             f.write( "%s\t%d\t%d\t%f\n" % (iv.chrom, iv.start, iv.end, value) )
 *       if not hasattr( file_or_filename, "write" ):
 */
        goto __pyx_L12_continue;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "HTSeq/_HTSeq.pyx":592
 *             if iv.start == -sys.maxint-1 or iv.end == sys.maxint:
 *                continue
 *             f.write( "%s\t%d\t%d\t%f\n" % (iv.chrom, iv.start, iv.end, value) )             # <<<<<<<<<<<<<<
 *       if not hasattr( file_or_filename, "write" ):
 *          f.close()
 */
      __pyx_t_12 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__write); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__chrom); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__start); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = PyObject_GetAttr(__pyx_v_iv, __pyx_n_s__end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_16));
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      __pyx_t_4 = 0;
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_45), ((PyObject *)__pyx_t_16)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
      __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_16));
      PyTuple_SET_ITEM(__pyx_t_16, 0, ((PyObject *)__pyx_t_14));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
      __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_L12_continue:;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":593
 *                continue
 *             f.write( "%s\t%d\t%d\t%f\n" % (iv.chrom, iv.start, iv.end, value) )
 *       if not hasattr( file_or_filename, "write" ):             # <<<<<<<<<<<<<<
 *          f.close()
 * 
 */
  __pyx_t_5 = ((PyObject *)__pyx_n_s__write);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = PyObject_HasAttr(__pyx_v_file_or_filename, __pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":594
 *             f.write( "%s\t%d\t%d\t%f\n" % (iv.chrom, iv.start, iv.end, value) )
 *       if not hasattr( file_or_filename, "write" ):
 *          f.close()             # <<<<<<<<<<<<<<
 * 
 *    def steps( self ):
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L17;
  }
  __pyx_L17:;

  __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_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.write_bedgraph_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_iv);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":596
 *          f.close()
 * 
 *    def steps( self ):             # <<<<<<<<<<<<<<
 *       return _HTSeq_internal.GenomicArray_steps( self )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_6steps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_6steps(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("steps");

  /* "HTSeq/_HTSeq.pyx":597
 * 
 *    def steps( self ):
 *       return _HTSeq_internal.GenomicArray_steps( self )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___HTSeq_internal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__GenomicArray_steps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __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 = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __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 = 597; __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_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("HTSeq._HTSeq.GenomicArray.steps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":480
 * cdef class GenomicArray( object ):
 * 
 *    cdef public dict chrom_vectors             # <<<<<<<<<<<<<<
 *    cdef readonly bint stranded
 *    cdef readonly str typecode
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.chrom_vectors.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->chrom_vectors = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":481
 * 
 *    cdef public dict chrom_vectors
 *    cdef readonly bint stranded             # <<<<<<<<<<<<<<
 *    cdef readonly str typecode
 *    cdef public bint auto_add_chroms
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8stranded___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8stranded___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->stranded); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __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("HTSeq._HTSeq.GenomicArray.stranded.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":482
 *    cdef public dict chrom_vectors
 *    cdef readonly bint stranded
 *    cdef readonly str typecode             # <<<<<<<<<<<<<<
 *    cdef public bint auto_add_chroms
 *    cdef readonly str storage
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8typecode___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8typecode___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->typecode);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":483
 *    cdef readonly bint stranded
 *    cdef readonly str typecode
 *    cdef public bint auto_add_chroms             # <<<<<<<<<<<<<<
 *    cdef readonly str storage
 *    cdef readonly str memmap_dir
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __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("HTSeq._HTSeq.GenomicArray.auto_add_chroms.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->auto_add_chroms = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.GenomicArray.auto_add_chroms.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":484
 *    cdef readonly str typecode
 *    cdef public bint auto_add_chroms
 *    cdef readonly str storage             # <<<<<<<<<<<<<<
 *    cdef readonly str memmap_dir
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_7storage___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_7storage___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->storage);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":485
 *    cdef public bint auto_add_chroms
 *    cdef readonly str storage
 *    cdef readonly str memmap_dir             # <<<<<<<<<<<<<<
 * 
 *    def __init__( self, object chroms, bint stranded=True, str typecode='d',
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_10memmap_dir___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_10memmap_dir___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_v_self)->memmap_dir);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":600
 * 
 * 
 * def _GenomicArray_unpickle( stranded, typecode, chrom_vectors ):             # <<<<<<<<<<<<<<
 *    ga = GenomicArray( {}, stranded, typecode )
 *    ga.chrom_vectors = chrom_vectors
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_2_GenomicArray_unpickle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5HTSeq_6_HTSeq_2_GenomicArray_unpickle = {__Pyx_NAMESTR("_GenomicArray_unpickle"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_2_GenomicArray_unpickle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_2_GenomicArray_unpickle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stranded = 0;
  PyObject *__pyx_v_typecode = 0;
  PyObject *__pyx_v_chrom_vectors = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *__pyx_v_ga = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stranded,&__pyx_n_s__typecode,&__pyx_n_s__chrom_vectors,0};
  __Pyx_RefNannySetupContext("_GenomicArray_unpickle");
  __pyx_self = __pyx_self;
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stranded);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__typecode);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_GenomicArray_unpickle", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom_vectors);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_GenomicArray_unpickle", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_GenomicArray_unpickle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __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_stranded = values[0];
    __pyx_v_typecode = values[1];
    __pyx_v_chrom_vectors = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_GenomicArray_unpickle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq._GenomicArray_unpickle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":601
 * 
 * def _GenomicArray_unpickle( stranded, typecode, chrom_vectors ):
 *    ga = GenomicArray( {}, stranded, typecode )             # <<<<<<<<<<<<<<
 *    ga.chrom_vectors = chrom_vectors
 *    return ga
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_stranded);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_stranded);
  __Pyx_GIVEREF(__pyx_v_stranded);
  __Pyx_INCREF(__pyx_v_typecode);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_typecode);
  __Pyx_GIVEREF(__pyx_v_typecode);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicArray)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_ga = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":602
 * def _GenomicArray_unpickle( stranded, typecode, chrom_vectors ):
 *    ga = GenomicArray( {}, stranded, typecode )
 *    ga.chrom_vectors = chrom_vectors             # <<<<<<<<<<<<<<
 *    return ga
 * 
 */
  if (!(likely(PyDict_CheckExact(__pyx_v_chrom_vectors))||((__pyx_v_chrom_vectors) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_chrom_vectors)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_chrom_vectors);
  __Pyx_GIVEREF(__pyx_v_chrom_vectors);
  __Pyx_GOTREF(__pyx_v_ga->chrom_vectors);
  __Pyx_DECREF(((PyObject *)__pyx_v_ga->chrom_vectors));
  __pyx_v_ga->chrom_vectors = ((PyObject*)__pyx_v_chrom_vectors);

  /* "HTSeq/_HTSeq.pyx":603
 *    ga = GenomicArray( {}, stranded, typecode )
 *    ga.chrom_vectors = chrom_vectors
 *    return ga             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ga));
  __pyx_r = ((PyObject *)__pyx_v_ga);
  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("HTSeq._HTSeq._GenomicArray_unpickle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ga);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":612
 * 
 * 
 * def _make_translation_table_for_complementation( ):             # <<<<<<<<<<<<<<
 *    t = [ chr(i) for i in xrange(256) ]
 *    t[ ord('A') ] = 'T'
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_3_make_translation_table_for_complementation(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_5HTSeq_6_HTSeq_3_make_translation_table_for_complementation = {__Pyx_NAMESTR("_make_translation_table_for_complementation"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_3_make_translation_table_for_complementation, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_3_make_translation_table_for_complementation(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_t = NULL;
  long __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_translation_table_for_complementation");
  __pyx_self = __pyx_self;

  /* "HTSeq/_HTSeq.pyx":613
 * 
 * def _make_translation_table_for_complementation( ):
 *    t = [ chr(i) for i in xrange(256) ]             # <<<<<<<<<<<<<<
 *    t[ ord('A') ] = 'T'
 *    t[ ord('T') ] = 'A'
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  for (__pyx_t_2 = 0; __pyx_t_2 < 256; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;
    __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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_chr, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_v_t = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":614
 * def _make_translation_table_for_complementation( ):
 *    t = [ chr(i) for i in xrange(256) ]
 *    t[ ord('A') ] = 'T'             # <<<<<<<<<<<<<<
 *    t[ ord('T') ] = 'A'
 *    t[ ord('C') ] = 'G'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_65, ((PyObject *)__pyx_n_s__T)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":615
 *    t = [ chr(i) for i in xrange(256) ]
 *    t[ ord('A') ] = 'T'
 *    t[ ord('T') ] = 'A'             # <<<<<<<<<<<<<<
 *    t[ ord('C') ] = 'G'
 *    t[ ord('G') ] = 'C'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_84, ((PyObject *)__pyx_n_s__A)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":616
 *    t[ ord('A') ] = 'T'
 *    t[ ord('T') ] = 'A'
 *    t[ ord('C') ] = 'G'             # <<<<<<<<<<<<<<
 *    t[ ord('G') ] = 'C'
 *    t[ ord('a') ] = 't'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_67, ((PyObject *)__pyx_n_s__G)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":617
 *    t[ ord('T') ] = 'A'
 *    t[ ord('C') ] = 'G'
 *    t[ ord('G') ] = 'C'             # <<<<<<<<<<<<<<
 *    t[ ord('a') ] = 't'
 *    t[ ord('t') ] = 'a'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_71, ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":618
 *    t[ ord('C') ] = 'G'
 *    t[ ord('G') ] = 'C'
 *    t[ ord('a') ] = 't'             # <<<<<<<<<<<<<<
 *    t[ ord('t') ] = 'a'
 *    t[ ord('c') ] = 'g'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_97, ((PyObject *)__pyx_n_s__t)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":619
 *    t[ ord('G') ] = 'C'
 *    t[ ord('a') ] = 't'
 *    t[ ord('t') ] = 'a'             # <<<<<<<<<<<<<<
 *    t[ ord('c') ] = 'g'
 *    t[ ord('g') ] = 'c'
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_116, ((PyObject *)__pyx_n_s__a)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":620
 *    t[ ord('a') ] = 't'
 *    t[ ord('t') ] = 'a'
 *    t[ ord('c') ] = 'g'             # <<<<<<<<<<<<<<
 *    t[ ord('g') ] = 'c'
 *    return ''.join( t )
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_99, ((PyObject *)__pyx_n_s__g)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":621
 *    t[ ord('t') ] = 'a'
 *    t[ ord('c') ] = 'g'
 *    t[ ord('g') ] = 'c'             # <<<<<<<<<<<<<<
 *    return ''.join( t )
 * 
 */
  if (PyObject_SetItem(((PyObject *)__pyx_v_t), __pyx_int_103, ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":622
 *    t[ ord('c') ] = 'g'
 *    t[ ord('g') ] = 'c'
 *    return ''.join( t )             # <<<<<<<<<<<<<<
 * 
 * cdef bytes _translation_table_for_complementation = _make_translation_table_for_complementation( )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_14), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_t));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_t));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_t));
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __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_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq._make_translation_table_for_complementation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":626
 * cdef bytes _translation_table_for_complementation = _make_translation_table_for_complementation( )
 * 
 * cpdef bytes reverse_complement( bytes seq ):             # <<<<<<<<<<<<<<
 *    """Returns the reverse complement of DNA sequence 'seq'. Does not yet
 *    work with extended IUPAC nucleotide letters or RNA."""
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_4reverse_complement(PyObject *__pyx_self, PyObject *__pyx_v_seq); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_reverse_complement(PyObject *__pyx_v_seq, 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reverse_complement");

  /* "HTSeq/_HTSeq.pyx":630
 *    work with extended IUPAC nucleotide letters or RNA."""
 * 
 *    return seq[ ::-1 ].translate( _translation_table_for_complementation )             # <<<<<<<<<<<<<<
 * 
 * base_to_column = { 'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4 }
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_seq), __pyx_k_slice_46); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_t_1), __pyx_n_s__translate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation));
  __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 = 630; __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;
  if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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("HTSeq._HTSeq.reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":626
 * cdef bytes _translation_table_for_complementation = _make_translation_table_for_complementation( )
 * 
 * cpdef bytes reverse_complement( bytes seq ):             # <<<<<<<<<<<<<<
 *    """Returns the reverse complement of DNA sequence 'seq'. Does not yet
 *    work with extended IUPAC nucleotide letters or RNA."""
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_4reverse_complement(PyObject *__pyx_self, PyObject *__pyx_v_seq); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_4reverse_complement[] = "Returns the reverse complement of DNA sequence 'seq'. Does not yet\n   work with extended IUPAC nucleotide letters or RNA.";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_4reverse_complement(PyObject *__pyx_self, PyObject *__pyx_v_seq) {
  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("reverse_complement");
  __pyx_self = __pyx_self;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_seq), (&PyBytes_Type), 1, "seq", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_reverse_complement(__pyx_v_seq, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __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("HTSeq._HTSeq.reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":638
 *    """
 * 
 *    def __init__( self, bytes seq, str name="unnamed" ):             # <<<<<<<<<<<<<<
 *       self.seq = seq
 *       self.name = name
 */

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_seq = 0;
  PyObject *__pyx_v_name = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seq,&__pyx_n_s__name,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject*)__pyx_n_s__unnamed);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_seq = ((PyObject*)values[0]);
    __pyx_v_name = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_seq), (&PyBytes_Type), 1, "seq", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":639
 * 
 *    def __init__( self, bytes seq, str name="unnamed" ):
 *       self.seq = seq             # <<<<<<<<<<<<<<
 *       self.name = name
 *       self.descr = None
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_seq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_seq));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq = __pyx_v_seq;

  /* "HTSeq/_HTSeq.pyx":640
 *    def __init__( self, bytes seq, str name="unnamed" ):
 *       self.seq = seq
 *       self.name = name             # <<<<<<<<<<<<<<
 *       self.descr = None
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name = __pyx_v_name;

  /* "HTSeq/_HTSeq.pyx":641
 *       self.seq = seq
 *       self.name = name
 *       self.descr = None             # <<<<<<<<<<<<<<
 * 
 *    cpdef Sequence get_reverse_complement( self ):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr = ((PyObject*)Py_None);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":643
 *       self.descr = None
 * 
 *    cpdef Sequence get_reverse_complement( self ):             # <<<<<<<<<<<<<<
 *       return Sequence(
 *          reverse_complement( self.seq ),
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_1get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_f_5HTSeq_6_HTSeq_8Sequence_get_reverse_complement(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__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("get_reverse_complement");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_47); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_8Sequence_1get_reverse_complement)) {
      __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 = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_Sequence))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":644
 * 
 *    cpdef Sequence get_reverse_complement( self ):
 *       return Sequence(             # <<<<<<<<<<<<<<
 *          reverse_complement( self.seq ),
 *          "revcomp_of_" + self.name )
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));

  /* "HTSeq/_HTSeq.pyx":645
 *    cpdef Sequence get_reverse_complement( self ):
 *       return Sequence(
 *          reverse_complement( self.seq ),             # <<<<<<<<<<<<<<
 *          "revcomp_of_" + self.name )
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->seq);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_reverse_complement(((PyObject*)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":646
 *       return Sequence(
 *          reverse_complement( self.seq ),
 *          "revcomp_of_" + self.name )             # <<<<<<<<<<<<<<
 * 
 *    def __str__( self ):
 */
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_n_s__revcomp_of_), ((PyObject *)__pyx_v_self->name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_Sequence)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)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("HTSeq._HTSeq.Sequence.get_reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":643
 *       self.descr = None
 * 
 *    cpdef Sequence get_reverse_complement( self ):             # <<<<<<<<<<<<<<
 *       return Sequence(
 *          reverse_complement( self.seq ),
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_1get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_1get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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_reverse_complement");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->__pyx_vtab)->get_reverse_complement(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __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("HTSeq._HTSeq.Sequence.get_reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":648
 *          "revcomp_of_" + self.name )
 * 
 *    def __str__( self ):             # <<<<<<<<<<<<<<
 *       return self.seq
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_2__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_2__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__");

  /* "HTSeq/_HTSeq.pyx":649
 * 
 *    def __str__( self ):
 *       return self.seq             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":651
 *       return self.seq
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       return "<%s object '%s' (length %d)>" % (
 *          self.__class__.__name__, self.name, len( self.seq ) )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_3__repr__(PyObject *__pyx_v_self) {
  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 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "HTSeq/_HTSeq.pyx":652
 * 
 *    def __repr__( self ):
 *       return "<%s object '%s' (length %d)>" % (             # <<<<<<<<<<<<<<
 *          self.__class__.__name__, self.name, len( self.seq ) )
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":653
 *    def __repr__( self ):
 *       return "<%s object '%s' (length %d)>" % (
 *          self.__class__.__name__, self.name, len( self.seq ) )             # <<<<<<<<<<<<<<
 * 
 *    def __len__( self ):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __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 *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __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 = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_48), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = ((PyObject *)__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_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":655
 *          self.__class__.__name__, self.name, len( self.seq ) )
 * 
 *    def __len__( self ):             # <<<<<<<<<<<<<<
 *       return len( self.seq )
 * 
 */

static Py_ssize_t __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__len__");

  /* "HTSeq/_HTSeq.pyx":656
 * 
 *    def __len__( self ):
 *       return len( self.seq )             # <<<<<<<<<<<<<<
 * 
 *    def __getitem__( self, item ):
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":658
 *       return len( self.seq )
 * 
 *    def __getitem__( self, item ):             # <<<<<<<<<<<<<<
 *       if self.name.endswith( "[part]" ):
 *          new_name = self.name
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_v_new_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__getitem__");

  /* "HTSeq/_HTSeq.pyx":659
 * 
 *    def __getitem__( self, item ):
 *       if self.name.endswith( "[part]" ):             # <<<<<<<<<<<<<<
 *          new_name = self.name
 *       else:
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name), ((PyObject *)__pyx_kp_s_49), 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":660
 *    def __getitem__( self, item ):
 *       if self.name.endswith( "[part]" ):
 *          new_name = self.name             # <<<<<<<<<<<<<<
 *       else:
 *          new_name = self.name + "[part]"
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
    __pyx_v_new_name = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":662
 *          new_name = self.name
 *       else:
 *          new_name = self.name + "[part]"             # <<<<<<<<<<<<<<
 *       return Sequence( self.seq[ item ], new_name )
 * 
 */
    __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name), ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_v_new_name = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":663
 *       else:
 *          new_name = self.name + "[part]"
 *       return Sequence( self.seq[ item ], new_name )             # <<<<<<<<<<<<<<
 * 
 *    def write_to_fasta_file( self, fasta_file ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq), __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __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 = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_new_name);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_name);
  __Pyx_GIVEREF(__pyx_v_new_name);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_Sequence)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":665
 *       return Sequence( self.seq[ item ], new_name )
 * 
 *    def write_to_fasta_file( self, fasta_file ):             # <<<<<<<<<<<<<<
 *       if self.descr is not None:
 *          fasta_file.write( ">%s %s\n" % ( self.name, self.descr ) )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_6write_to_fasta_file(PyObject *__pyx_v_self, PyObject *__pyx_v_fasta_file); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_6write_to_fasta_file(PyObject *__pyx_v_self, PyObject *__pyx_v_fasta_file) {
  PyObject *__pyx_v_i = 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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("write_to_fasta_file");

  /* "HTSeq/_HTSeq.pyx":666
 * 
 *    def write_to_fasta_file( self, fasta_file ):
 *       if self.descr is not None:             # <<<<<<<<<<<<<<
 *          fasta_file.write( ">%s %s\n" % ( self.name, self.descr ) )
 *       else:
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr != ((PyObject*)Py_None));
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":667
 *    def write_to_fasta_file( self, fasta_file ):
 *       if self.descr is not None:
 *          fasta_file.write( ">%s %s\n" % ( self.name, self.descr ) )             # <<<<<<<<<<<<<<
 *       else:
 *          fasta_file.write( ">%s\n" % self.name )
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_fasta_file, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __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 = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_50), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__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 = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__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 = 667; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":669
 *          fasta_file.write( ">%s %s\n" % ( self.name, self.descr ) )
 *       else:
 *          fasta_file.write( ">%s\n" % self.name )             # <<<<<<<<<<<<<<
 *       i = 0
 *       while i*70 < len(self.seq):
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_fasta_file, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 669; __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;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":670
 *       else:
 *          fasta_file.write( ">%s\n" % self.name )
 *       i = 0             # <<<<<<<<<<<<<<
 *       while i*70 < len(self.seq):
 *          fasta_file.write( self.seq[ i*70 : (i+1)*70 ] + "\n" )
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_i = __pyx_int_0;

  /* "HTSeq/_HTSeq.pyx":671
 *          fasta_file.write( ">%s\n" % self.name )
 *       i = 0
 *       while i*70 < len(self.seq):             # <<<<<<<<<<<<<<
 *          fasta_file.write( self.seq[ i*70 : (i+1)*70 ] + "\n" )
 *          i += 1
 */
  while (1) {
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_i, __pyx_int_70); 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_2 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
    __Pyx_INCREF(__pyx_t_2);
    if (unlikely(__pyx_t_2 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_2); 
    __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 = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_LT); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_1) break;

    /* "HTSeq/_HTSeq.pyx":672
 *       i = 0
 *       while i*70 < len(self.seq):
 *          fasta_file.write( self.seq[ i*70 : (i+1)*70 ] + "\n" )             # <<<<<<<<<<<<<<
 *          i += 1
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_fasta_file, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_i, __pyx_int_70); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_int_70); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq), __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_kp_s_52)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "HTSeq/_HTSeq.pyx":673
 *       while i*70 < len(self.seq):
 *          fasta_file.write( self.seq[ i*70 : (i+1)*70 ] + "\n" )
 *          i += 1             # <<<<<<<<<<<<<<
 * 
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ ):
 */
    __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.write_to_fasta_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":675
 *          i += 1
 * 
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ ):             # <<<<<<<<<<<<<<
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_7add_bases_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_8Sequence_add_bases_to_count_array(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, PyArrayObject *__pyx_v_count_array_, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_count_array = 0;
  int __pyx_v_seq_length;
  npy_intp __pyx_v_i;
  char __pyx_v_b;
  char *__pyx_v_seq_cstr;
  Py_buffer __pyx_bstruct_count_array;
  Py_ssize_t __pyx_bstride_0_count_array = 0;
  Py_ssize_t __pyx_bstride_1_count_array = 0;
  Py_ssize_t __pyx_bshape_0_count_array = 0;
  Py_ssize_t __pyx_bshape_1_count_array = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  int __pyx_t_7;
  npy_intp __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  npy_intp __pyx_t_11;
  long __pyx_t_12;
  int __pyx_t_13;
  npy_intp __pyx_t_14;
  long __pyx_t_15;
  npy_intp __pyx_t_16;
  long __pyx_t_17;
  npy_intp __pyx_t_18;
  long __pyx_t_19;
  int __pyx_t_20;
  npy_intp __pyx_t_21;
  long __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_bases_to_count_array");
  __pyx_bstruct_count_array.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_53); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_8Sequence_7add_bases_to_count_array)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_count_array_));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_count_array_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_count_array_));
      __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 = 675; __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;
  }

  /* "HTSeq/_HTSeq.pyx":677
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ ):
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_             # <<<<<<<<<<<<<<
 *       cdef int seq_length = len( self.seq )
 * 
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_count_array, (PyObject*)((PyArrayObject *)__pyx_v_count_array_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_count_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_count_array.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_count_array = __pyx_bstruct_count_array.strides[0]; __pyx_bstride_1_count_array = __pyx_bstruct_count_array.strides[1];
      __pyx_bshape_0_count_array = __pyx_bstruct_count_array.shape[0]; __pyx_bshape_1_count_array = __pyx_bstruct_count_array.shape[1];
    }
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_count_array_));
  __pyx_v_count_array = ((PyArrayObject *)__pyx_v_count_array_);

  /* "HTSeq/_HTSeq.pyx":678
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_
 *       cdef int seq_length = len( self.seq )             # <<<<<<<<<<<<<<
 * 
 *       if numpy.PyArray_DIMS( count_array )[0] < seq_length:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seq_length = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":680
 *       cdef int seq_length = len( self.seq )
 * 
 *       if numpy.PyArray_DIMS( count_array )[0] < seq_length:             # <<<<<<<<<<<<<<
 *          raise ValueError, "'count_array' too small for sequence."
 *       if numpy.PyArray_DIMS( count_array )[1] < 5:
 */
  __pyx_t_5 = ((PyArray_DIMS(((PyArrayObject *)__pyx_v_count_array))[0]) < __pyx_v_seq_length);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":681
 * 
 *       if numpy.PyArray_DIMS( count_array )[0] < seq_length:
 *          raise ValueError, "'count_array' too small for sequence."             # <<<<<<<<<<<<<<
 *       if numpy.PyArray_DIMS( count_array )[1] < 5:
 *          raise ValueError, "'count_array' has too few columns."
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_54), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":682
 *       if numpy.PyArray_DIMS( count_array )[0] < seq_length:
 *          raise ValueError, "'count_array' too small for sequence."
 *       if numpy.PyArray_DIMS( count_array )[1] < 5:             # <<<<<<<<<<<<<<
 *          raise ValueError, "'count_array' has too few columns."
 * 
 */
  __pyx_t_5 = ((PyArray_DIMS(((PyArrayObject *)__pyx_v_count_array))[1]) < 5);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":683
 *          raise ValueError, "'count_array' too small for sequence."
 *       if numpy.PyArray_DIMS( count_array )[1] < 5:
 *          raise ValueError, "'count_array' has too few columns."             # <<<<<<<<<<<<<<
 * 
 *       cdef numpy.npy_intp i
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_55), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":687
 *       cdef numpy.npy_intp i
 *       cdef char b
 *       cdef char* seq_cstr = self.seq             # <<<<<<<<<<<<<<
 *       for i in xrange( seq_length ):
 *          b = seq_cstr[i]
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seq_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":688
 *       cdef char b
 *       cdef char* seq_cstr = self.seq
 *       for i in xrange( seq_length ):             # <<<<<<<<<<<<<<
 *          b = seq_cstr[i]
 *          if b == 'A' or b == 'a':
 */
  __pyx_t_7 = __pyx_v_seq_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "HTSeq/_HTSeq.pyx":689
 *       cdef char* seq_cstr = self.seq
 *       for i in xrange( seq_length ):
 *          b = seq_cstr[i]             # <<<<<<<<<<<<<<
 *          if b == 'A' or b == 'a':
 *             count_array[ i, 0 ] += 1
 */
    __pyx_v_b = (__pyx_v_seq_cstr[__pyx_v_i]);

    /* "HTSeq/_HTSeq.pyx":690
 *       for i in xrange( seq_length ):
 *          b = seq_cstr[i]
 *          if b == 'A' or b == 'a':             # <<<<<<<<<<<<<<
 *             count_array[ i, 0 ] += 1
 *          elif b == 'C' or b == 'c':
 */
    __pyx_t_5 = (__pyx_v_b == 'A');
    if (!__pyx_t_5) {
      __pyx_t_9 = (__pyx_v_b == 'a');
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_5;
    }
    if (__pyx_t_10) {

      /* "HTSeq/_HTSeq.pyx":691
 *          b = seq_cstr[i]
 *          if b == 'A' or b == 'a':
 *             count_array[ i, 0 ] += 1             # <<<<<<<<<<<<<<
 *          elif b == 'C' or b == 'c':
 *             count_array[ i, 1 ] += 1
 */
      __pyx_t_11 = __pyx_v_i;
      __pyx_t_12 = 0;
      __pyx_t_13 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_count_array;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_count_array)) __pyx_t_13 = 0;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_bshape_1_count_array;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_12 >= __pyx_bshape_1_count_array)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_11, __pyx_bstride_0_count_array, __pyx_t_12, __pyx_bstride_1_count_array) += 1;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":692
 *          if b == 'A' or b == 'a':
 *             count_array[ i, 0 ] += 1
 *          elif b == 'C' or b == 'c':             # <<<<<<<<<<<<<<
 *             count_array[ i, 1 ] += 1
 *          elif b == 'G' or b == 'g':
 */
    __pyx_t_10 = (__pyx_v_b == 'C');
    if (!__pyx_t_10) {
      __pyx_t_5 = (__pyx_v_b == 'c');
      __pyx_t_9 = __pyx_t_5;
    } else {
      __pyx_t_9 = __pyx_t_10;
    }
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":693
 *             count_array[ i, 0 ] += 1
 *          elif b == 'C' or b == 'c':
 *             count_array[ i, 1 ] += 1             # <<<<<<<<<<<<<<
 *          elif b == 'G' or b == 'g':
 *             count_array[ i, 2 ] += 1
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = 1;
      __pyx_t_13 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_bshape_0_count_array;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_count_array)) __pyx_t_13 = 0;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_bshape_1_count_array;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_15 >= __pyx_bshape_1_count_array)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_14, __pyx_bstride_0_count_array, __pyx_t_15, __pyx_bstride_1_count_array) += 1;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":694
 *          elif b == 'C' or b == 'c':
 *             count_array[ i, 1 ] += 1
 *          elif b == 'G' or b == 'g':             # <<<<<<<<<<<<<<
 *             count_array[ i, 2 ] += 1
 *          elif b == 'T' or b == 't':
 */
    __pyx_t_9 = (__pyx_v_b == 'G');
    if (!__pyx_t_9) {
      __pyx_t_10 = (__pyx_v_b == 'g');
      __pyx_t_5 = __pyx_t_10;
    } else {
      __pyx_t_5 = __pyx_t_9;
    }
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":695
 *             count_array[ i, 1 ] += 1
 *          elif b == 'G' or b == 'g':
 *             count_array[ i, 2 ] += 1             # <<<<<<<<<<<<<<
 *          elif b == 'T' or b == 't':
 *             count_array[ i, 3 ] += 1
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = 2;
      __pyx_t_13 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_bshape_0_count_array;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_count_array)) __pyx_t_13 = 0;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_bshape_1_count_array;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_count_array)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_16, __pyx_bstride_0_count_array, __pyx_t_17, __pyx_bstride_1_count_array) += 1;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":696
 *          elif b == 'G' or b == 'g':
 *             count_array[ i, 2 ] += 1
 *          elif b == 'T' or b == 't':             # <<<<<<<<<<<<<<
 *             count_array[ i, 3 ] += 1
 *          elif b == 'N' or b == 'n' or b == ".":
 */
    __pyx_t_5 = (__pyx_v_b == 'T');
    if (!__pyx_t_5) {
      __pyx_t_9 = (__pyx_v_b == 't');
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_5;
    }
    if (__pyx_t_10) {

      /* "HTSeq/_HTSeq.pyx":697
 *             count_array[ i, 2 ] += 1
 *          elif b == 'T' or b == 't':
 *             count_array[ i, 3 ] += 1             # <<<<<<<<<<<<<<
 *          elif b == 'N' or b == 'n' or b == ".":
 *             count_array[ i, 4 ] += 1
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = 3;
      __pyx_t_13 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_bshape_0_count_array;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_count_array)) __pyx_t_13 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_bshape_1_count_array;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_count_array)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_18, __pyx_bstride_0_count_array, __pyx_t_19, __pyx_bstride_1_count_array) += 1;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":698
 *          elif b == 'T' or b == 't':
 *             count_array[ i, 3 ] += 1
 *          elif b == 'N' or b == 'n' or b == ".":             # <<<<<<<<<<<<<<
 *             count_array[ i, 4 ] += 1
 *          else:
 */
    __pyx_t_10 = (__pyx_v_b == 'N');
    if (!__pyx_t_10) {
      __pyx_t_5 = (__pyx_v_b == 'n');
      if (!__pyx_t_5) {
        __pyx_t_9 = (__pyx_v_b == '.');
        __pyx_t_20 = __pyx_t_9;
      } else {
        __pyx_t_20 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_20;
    } else {
      __pyx_t_5 = __pyx_t_10;
    }
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":699
 *             count_array[ i, 3 ] += 1
 *          elif b == 'N' or b == 'n' or b == ".":
 *             count_array[ i, 4 ] += 1             # <<<<<<<<<<<<<<
 *          else:
 *             raise ValueError, "Illegal base letter encountered."
 */
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_22 = 4;
      __pyx_t_13 = -1;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_bshape_0_count_array;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_count_array)) __pyx_t_13 = 0;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_bshape_1_count_array;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_13 = 1;
      } else if (unlikely(__pyx_t_22 >= __pyx_bshape_1_count_array)) __pyx_t_13 = 1;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_21, __pyx_bstride_0_count_array, __pyx_t_22, __pyx_bstride_1_count_array) += 1;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":701
 *             count_array[ i, 4 ] += 1
 *          else:
 *             raise ValueError, "Illegal base letter encountered."             # <<<<<<<<<<<<<<
 * 
 *       return None
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_56), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L7:;
  }

  /* "HTSeq/_HTSeq.pyx":703
 *             raise ValueError, "Illegal base letter encountered."
 * 
 *       return None             # <<<<<<<<<<<<<<
 * 
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count_array);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.add_bases_to_count_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count_array);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_count_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":675
 *          i += 1
 * 
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ ):             # <<<<<<<<<<<<<<
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_7add_bases_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_7add_bases_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_) {
  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("add_bases_to_count_array");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_count_array_), __pyx_ptype_5numpy_ndarray, 1, "count_array_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->__pyx_vtab)->add_bases_to_count_array(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self), ((PyArrayObject *)__pyx_v_count_array_), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __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("HTSeq._HTSeq.Sequence.add_bases_to_count_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":705
 *       return None
 * 
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_8trim_left_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_f_5HTSeq_6_HTSeq_8Sequence_trim_left_end(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end *__pyx_optional_args) {
  float __pyx_v_mismatch_prop = ((float)0.);
  int __pyx_v_seqlen;
  int __pyx_v_patlen;
  int __pyx_v_minlen;
  char *__pyx_v_seq_cstr;
  char *__pyx_v_pat_cstr;
  int __pyx_v_match;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_num_mismatches;
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  long __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("trim_left_end");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_mismatch_prop = __pyx_optional_args->mismatch_prop;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__trim_left_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_8Sequence_8trim_left_end)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mismatch_prop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
      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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_Sequence))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":706
 * 
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 *       cdef int seqlen = len( self.seq )             # <<<<<<<<<<<<<<
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seqlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":707
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )             # <<<<<<<<<<<<<<
 *       cdef int minlen
 *       if seqlen < patlen:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_pattern->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_patlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":709
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 *       if seqlen < patlen:             # <<<<<<<<<<<<<<
 *          minlen = seqlen
 *       else:
 */
  __pyx_t_5 = (__pyx_v_seqlen < __pyx_v_patlen);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":710
 *       cdef int minlen
 *       if seqlen < patlen:
 *          minlen = seqlen             # <<<<<<<<<<<<<<
 *       else:
 *          minlen = patlen
 */
    __pyx_v_minlen = __pyx_v_seqlen;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":712
 *          minlen = seqlen
 *       else:
 *          minlen = patlen             # <<<<<<<<<<<<<<
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 */
    __pyx_v_minlen = __pyx_v_patlen;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":713
 *       else:
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq             # <<<<<<<<<<<<<<
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seq_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":714
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq             # <<<<<<<<<<<<<<
 *       cdef int match = 0
 *       cdef int i, j
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_pattern->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pat_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":715
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0             # <<<<<<<<<<<<<<
 *       cdef int i, j
 *       cdef int num_mismatches
 */
  __pyx_v_match = 0;

  /* "HTSeq/_HTSeq.pyx":718
 *       cdef int i, j
 *       cdef int num_mismatches
 *       for i in xrange( 1, minlen+1 ):             # <<<<<<<<<<<<<<
 *          num_mismatches = 0
 *          for j in xrange( i ):
 */
  __pyx_t_7 = (__pyx_v_minlen + 1);
  for (__pyx_t_8 = 1; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "HTSeq/_HTSeq.pyx":719
 *       cdef int num_mismatches
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0             # <<<<<<<<<<<<<<
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 */
    __pyx_v_num_mismatches = 0;

    /* "HTSeq/_HTSeq.pyx":720
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0
 *          for j in xrange( i ):             # <<<<<<<<<<<<<<
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                num_mismatches += 1
 */
    __pyx_t_9 = __pyx_v_i;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_j = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":721
 *          num_mismatches = 0
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:             # <<<<<<<<<<<<<<
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:
 */
      __pyx_t_5 = ((__pyx_v_seq_cstr[__pyx_v_j]) != (__pyx_v_pat_cstr[((__pyx_v_patlen - __pyx_v_i) + __pyx_v_j)]));
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":722
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                num_mismatches += 1             # <<<<<<<<<<<<<<
 *                if num_mismatches > mismatch_prop * i:
 *                   break
 */
        __pyx_v_num_mismatches = (__pyx_v_num_mismatches + 1);

        /* "HTSeq/_HTSeq.pyx":723
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:             # <<<<<<<<<<<<<<
 *                   break
 *          else:
 */
        __pyx_t_5 = (__pyx_v_num_mismatches > (__pyx_v_mismatch_prop * __pyx_v_i));
        if (__pyx_t_5) {

          /* "HTSeq/_HTSeq.pyx":724
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:
 *                   break             # <<<<<<<<<<<<<<
 *          else:
 *             match = i
 */
          goto __pyx_L7_break;
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":726
 *                   break
 *          else:
 *             match = i             # <<<<<<<<<<<<<<
 *       return self[ match : seqlen ]
 * 
 */
      __pyx_v_match = __pyx_v_i;
    }
    __pyx_L7_break:;
  }

  /* "HTSeq/_HTSeq.pyx":727
 *          else:
 *             match = i
 *       return self[ match : seqlen ]             # <<<<<<<<<<<<<<
 * 
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_self), __pyx_v_match, __pyx_v_seqlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5HTSeq_6_HTSeq_Sequence))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)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("HTSeq._HTSeq.Sequence.trim_left_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":705
 *       return None
 * 
 *    cpdef Sequence trim_left_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_8trim_left_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_8trim_left_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern = 0;
  float __pyx_v_mismatch_prop;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pattern,&__pyx_n_s__mismatch_prop,0};
  __Pyx_RefNannySetupContext("trim_left_end");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mismatch_prop);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "trim_left_end") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)values[0]);
    if (values[1]) {
      __pyx_v_mismatch_prop = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mismatch_prop == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_mismatch_prop = ((float)0.);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trim_left_end", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.trim_left_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_5HTSeq_6_HTSeq_Sequence, 1, "pattern", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.mismatch_prop = __pyx_v_mismatch_prop;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->__pyx_vtab)->trim_left_end(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self), __pyx_v_pattern, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __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("HTSeq._HTSeq.Sequence.trim_left_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":729
 *       return self[ match : seqlen ]
 * 
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_9trim_right_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_f_5HTSeq_6_HTSeq_8Sequence_trim_right_end(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end *__pyx_optional_args) {
  float __pyx_v_mismatch_prop = ((float)0.);
  int __pyx_v_seqlen;
  int __pyx_v_patlen;
  int __pyx_v_minlen;
  char *__pyx_v_seq_cstr;
  char *__pyx_v_pat_cstr;
  int __pyx_v_match;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_num_mismatches;
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  long __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("trim_right_end");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_mismatch_prop = __pyx_optional_args->mismatch_prop;
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__trim_right_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_8Sequence_9trim_right_end)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mismatch_prop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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 = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
      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 = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_Sequence))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":730
 * 
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 *       cdef int seqlen = len( self.seq )             # <<<<<<<<<<<<<<
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seqlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":731
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )             # <<<<<<<<<<<<<<
 *       cdef int minlen
 *       if seqlen < patlen:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_pattern->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_patlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":733
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 *       if seqlen < patlen:             # <<<<<<<<<<<<<<
 *          minlen = seqlen
 *       else:
 */
  __pyx_t_5 = (__pyx_v_seqlen < __pyx_v_patlen);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":734
 *       cdef int minlen
 *       if seqlen < patlen:
 *          minlen = seqlen             # <<<<<<<<<<<<<<
 *       else:
 *          minlen = patlen
 */
    __pyx_v_minlen = __pyx_v_seqlen;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":736
 *          minlen = seqlen
 *       else:
 *          minlen = patlen             # <<<<<<<<<<<<<<
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 */
    __pyx_v_minlen = __pyx_v_patlen;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":737
 *       else:
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq             # <<<<<<<<<<<<<<
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seq_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":738
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq             # <<<<<<<<<<<<<<
 *       cdef int match = 0
 *       cdef int i, j
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_pattern->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pat_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":739
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0             # <<<<<<<<<<<<<<
 *       cdef int i, j
 *       cdef int num_mismatches
 */
  __pyx_v_match = 0;

  /* "HTSeq/_HTSeq.pyx":742
 *       cdef int i, j
 *       cdef int num_mismatches
 *       for i in xrange( 1, minlen+1 ):             # <<<<<<<<<<<<<<
 *          num_mismatches = 0
 *          for j in xrange( i ):
 */
  __pyx_t_7 = (__pyx_v_minlen + 1);
  for (__pyx_t_8 = 1; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "HTSeq/_HTSeq.pyx":743
 *       cdef int num_mismatches
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0             # <<<<<<<<<<<<<<
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 */
    __pyx_v_num_mismatches = 0;

    /* "HTSeq/_HTSeq.pyx":744
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0
 *          for j in xrange( i ):             # <<<<<<<<<<<<<<
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                num_mismatches += 1
 */
    __pyx_t_9 = __pyx_v_i;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_j = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":745
 *          num_mismatches = 0
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:             # <<<<<<<<<<<<<<
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:
 */
      __pyx_t_5 = ((__pyx_v_seq_cstr[((__pyx_v_seqlen - __pyx_v_i) + __pyx_v_j)]) != (__pyx_v_pat_cstr[__pyx_v_j]));
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":746
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                num_mismatches += 1             # <<<<<<<<<<<<<<
 *                if num_mismatches > mismatch_prop * i:
 *                   break
 */
        __pyx_v_num_mismatches = (__pyx_v_num_mismatches + 1);

        /* "HTSeq/_HTSeq.pyx":747
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:             # <<<<<<<<<<<<<<
 *                   break
 *          else:
 */
        __pyx_t_5 = (__pyx_v_num_mismatches > (__pyx_v_mismatch_prop * __pyx_v_i));
        if (__pyx_t_5) {

          /* "HTSeq/_HTSeq.pyx":748
 *                num_mismatches += 1
 *                if num_mismatches > mismatch_prop * i:
 *                   break             # <<<<<<<<<<<<<<
 *          else:
 *             match = i
 */
          goto __pyx_L7_break;
          goto __pyx_L9;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }
      __pyx_L8:;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":750
 *                   break
 *          else:
 *             match = i             # <<<<<<<<<<<<<<
 *       return self[ 0 : seqlen-match ]
 * 
 */
      __pyx_v_match = __pyx_v_i;
    }
    __pyx_L7_break:;
  }

  /* "HTSeq/_HTSeq.pyx":751
 *          else:
 *             match = i
 *       return self[ 0 : seqlen-match ]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_self), 0, (__pyx_v_seqlen - __pyx_v_match)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5HTSeq_6_HTSeq_Sequence))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)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("HTSeq._HTSeq.Sequence.trim_right_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":729
 *       return self[ match : seqlen ]
 * 
 *    cpdef Sequence trim_right_end( Sequence self, Sequence pattern, float mismatch_prop = 0. ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_9trim_right_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_9trim_right_end(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern = 0;
  float __pyx_v_mismatch_prop;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pattern,&__pyx_n_s__mismatch_prop,0};
  __Pyx_RefNannySetupContext("trim_right_end");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mismatch_prop);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "trim_right_end") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)values[0]);
    if (values[1]) {
      __pyx_v_mismatch_prop = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mismatch_prop == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_mismatch_prop = ((float)0.);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trim_right_end", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.trim_right_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_5HTSeq_6_HTSeq_Sequence, 1, "pattern", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.mismatch_prop = __pyx_v_mismatch_prop;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->__pyx_vtab)->trim_right_end(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self), __pyx_v_pattern, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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("HTSeq._HTSeq.Sequence.trim_right_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":20
 * 
 * cdef class Sequence( object ):
 *    cdef public bytes seq             # <<<<<<<<<<<<<<
 *    cdef public str name
 *    cdef public str descr
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyBytes_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.seq.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->seq = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":21
 * cdef class Sequence( object ):
 *    cdef public bytes seq
 *    cdef public str name             # <<<<<<<<<<<<<<
 *    cdef public str descr
 *    cpdef Sequence get_reverse_complement( self )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->name = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":22
 *    cdef public bytes seq
 *    cdef public str name
 *    cdef public str descr             # <<<<<<<<<<<<<<
 *    cpdef Sequence get_reverse_complement( self )
 *    cpdef object add_bases_to_count_array( Sequence self, numpy.ndarray count_array_ )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Sequence.descr.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self)->descr = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":760
 *    """
 * 
 *    def __init__( self, bytes seq, str name, bytes qualstr, str qualscale="phred" ):             # <<<<<<<<<<<<<<
 *       """ Construct a SequenceWithQuality object.
 * 
 */

static int __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_21SequenceWithQualities___init__[] = " Construct a SequenceWithQuality object.\n      \n        seq       - The actual sequence.\n        name      - The sequence name or ID\n        qualstr   - The quality string. Must have the same length as seq\n        qualscale - The encoding scale of the quality string. Must be one of\n                      \"phred\", \"solexa\", \"solexa-old\", or \"noquals\" )\n      ";
struct wrapperbase __pyx_wrapperbase_5HTSeq_6_HTSeq_21SequenceWithQualities___init__;
static int __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_seq = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_qualstr = 0;
  PyObject *__pyx_v_qualscale = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seq,&__pyx_n_s__name,&__pyx_n_s__qualstr,&__pyx_n_s__qualscale,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject*)__pyx_n_s__phred);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__qualstr);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__qualscale);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_seq = ((PyObject*)values[0]);
    __pyx_v_name = ((PyObject*)values[1]);
    __pyx_v_qualstr = ((PyObject*)values[2]);
    __pyx_v_qualscale = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_seq), (&PyBytes_Type), 1, "seq", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 1, "name", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qualstr), (&PyBytes_Type), 1, "qualstr", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qualscale), (&PyString_Type), 1, "qualscale", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":769
 *                       "phred", "solexa", "solexa-old", or "noquals" )
 *       """
 *       Sequence.__init__( self, seq, name )             # <<<<<<<<<<<<<<
 *       if qualscale != "noquals":
 *          if len( seq ) != len( qualstr ):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_Sequence)), __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __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 = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(((PyObject *)__pyx_v_seq));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_seq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_seq));
  __Pyx_INCREF(((PyObject *)__pyx_v_name));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_name));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_name));
  __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 = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":770
 *       """
 *       Sequence.__init__( self, seq, name )
 *       if qualscale != "noquals":             # <<<<<<<<<<<<<<
 *          if len( seq ) != len( qualstr ):
 *             raise ValueError, "'seq' and 'qualstr' do not have the same length."
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_qualscale), ((PyObject *)__pyx_n_s__noquals), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":771
 *       Sequence.__init__( self, seq, name )
 *       if qualscale != "noquals":
 *          if len( seq ) != len( qualstr ):             # <<<<<<<<<<<<<<
 *             raise ValueError, "'seq' and 'qualstr' do not have the same length."
 *          self._qualstr = qualstr
 */
    if (unlikely(((PyObject *)__pyx_v_seq) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_5 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_seq)); 
    if (unlikely(((PyObject *)__pyx_v_qualstr) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_6 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_qualstr)); 
    __pyx_t_4 = (__pyx_t_5 != __pyx_t_6);
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":772
 *       if qualscale != "noquals":
 *          if len( seq ) != len( qualstr ):
 *             raise ValueError, "'seq' and 'qualstr' do not have the same length."             # <<<<<<<<<<<<<<
 *          self._qualstr = qualstr
 *       else:
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_57), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":773
 *          if len( seq ) != len( qualstr ):
 *             raise ValueError, "'seq' and 'qualstr' do not have the same length."
 *          self._qualstr = qualstr             # <<<<<<<<<<<<<<
 *       else:
 *          self._qualstr = b''
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_qualstr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_qualstr));
    __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
    ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr = __pyx_v_qualstr;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":775
 *          self._qualstr = qualstr
 *       else:
 *          self._qualstr = b''             # <<<<<<<<<<<<<<
 *       self._qualscale = qualscale
 *       self._qualarr = None
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_b_14));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_14));
    __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
    ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr = __pyx_kp_b_14;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":776
 *       else:
 *          self._qualstr = b''
 *       self._qualscale = qualscale             # <<<<<<<<<<<<<<
 *       self._qualarr = None
 *       self._qualstr_phred = b''
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_qualscale));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_qualscale));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale = __pyx_v_qualscale;

  /* "HTSeq/_HTSeq.pyx":777
 *          self._qualstr = b''
 *       self._qualscale = qualscale
 *       self._qualarr = None             # <<<<<<<<<<<<<<
 *       self._qualstr_phred = b''
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  __Pyx_DECREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr = Py_None;

  /* "HTSeq/_HTSeq.pyx":778
 *       self._qualscale = qualscale
 *       self._qualarr = None
 *       self._qualstr_phred = b''             # <<<<<<<<<<<<<<
 * 
 *    cdef _fill_qual_arr( SequenceWithQualities self ):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred = __pyx_kp_b_14;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":780
 *       self._qualstr_phred = b''
 * 
 *    cdef _fill_qual_arr( SequenceWithQualities self ):             # <<<<<<<<<<<<<<
 *       cdef int seq_len = len( self.seq )
 *       if self._qualscale == "missing":
 */

static PyObject *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities__fill_qual_arr(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_self) {
  int __pyx_v_seq_len;
  PyArrayObject *__pyx_v_qualarr = 0;
  int __pyx_v_i;
  char *__pyx_v_qualstr;
  Py_buffer __pyx_bstruct_qualarr;
  Py_ssize_t __pyx_bstride_0_qualarr = 0;
  Py_ssize_t __pyx_bshape_0_qualarr = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  char *__pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __pyx_t_5numpy_int_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fill_qual_arr");
  __pyx_bstruct_qualarr.buf = NULL;

  /* "HTSeq/_HTSeq.pyx":781
 * 
 *    cdef _fill_qual_arr( SequenceWithQualities self ):
 *       cdef int seq_len = len( self.seq )             # <<<<<<<<<<<<<<
 *       if self._qualscale == "missing":
 *          raise ValueError, "Quality string missing."
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seq_len = __pyx_t_2;

  /* "HTSeq/_HTSeq.pyx":782
 *    cdef _fill_qual_arr( SequenceWithQualities self ):
 *       cdef int seq_len = len( self.seq )
 *       if self._qualscale == "missing":             # <<<<<<<<<<<<<<
 *          raise ValueError, "Quality string missing."
 *       if seq_len != len( self._qualstr ):
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->_qualscale), ((PyObject *)__pyx_n_s__missing), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":783
 *       cdef int seq_len = len( self.seq )
 *       if self._qualscale == "missing":
 *          raise ValueError, "Quality string missing."             # <<<<<<<<<<<<<<
 *       if seq_len != len( self._qualstr ):
 *          raise ValueError, "Quality string has not the same length as sequence."
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_58), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":784
 *       if self._qualscale == "missing":
 *          raise ValueError, "Quality string missing."
 *       if seq_len != len( self._qualstr ):             # <<<<<<<<<<<<<<
 *          raise ValueError, "Quality string has not the same length as sequence."
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qualarr = numpy.empty( ( seq_len, ), numpy.int )
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->_qualstr);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_v_seq_len != __pyx_t_2);
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":785
 *          raise ValueError, "Quality string missing."
 *       if seq_len != len( self._qualstr ):
 *          raise ValueError, "Quality string has not the same length as sequence."             # <<<<<<<<<<<<<<
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qualarr = numpy.empty( ( seq_len, ), numpy.int )
 *       cdef int i
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_59), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":786
 *       if seq_len != len( self._qualstr ):
 *          raise ValueError, "Quality string has not the same length as sequence."
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qualarr = numpy.empty( ( seq_len, ), numpy.int )             # <<<<<<<<<<<<<<
 *       cdef int i
 *       cdef char * qualstr = self._qualstr
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __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_seq_len); 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_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __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_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_qualarr, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_qualarr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_qualarr.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_qualarr = __pyx_bstruct_qualarr.strides[0];
      __pyx_bshape_0_qualarr = __pyx_bstruct_qualarr.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_qualarr = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "HTSeq/_HTSeq.pyx":788
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qualarr = numpy.empty( ( seq_len, ), numpy.int )
 *       cdef int i
 *       cdef char * qualstr = self._qualstr             # <<<<<<<<<<<<<<
 *       if self._qualscale == "phred":
 *          for i in xrange( seq_len ):
 */
  __pyx_t_8 = PyBytes_AsString(((PyObject *)__pyx_v_self->_qualstr)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_qualstr = __pyx_t_8;

  /* "HTSeq/_HTSeq.pyx":789
 *       cdef int i
 *       cdef char * qualstr = self._qualstr
 *       if self._qualscale == "phred":             # <<<<<<<<<<<<<<
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 33
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->_qualscale), ((PyObject *)__pyx_n_s__phred), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":790
 *       cdef char * qualstr = self._qualstr
 *       if self._qualscale == "phred":
 *          for i in xrange( seq_len ):             # <<<<<<<<<<<<<<
 *             qualarr[i] = qualstr[i] - 33
 *       elif self._qualscale == "solexa":
 */
    __pyx_t_9 = __pyx_v_seq_len;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":791
 *       if self._qualscale == "phred":
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 33             # <<<<<<<<<<<<<<
 *       elif self._qualscale == "solexa":
 *          for i in xrange( seq_len ):
 */
      __pyx_t_11 = __pyx_v_i;
      __pyx_t_12 = -1;
      if (__pyx_t_11 < 0) {
        __pyx_t_11 += __pyx_bshape_0_qualarr;
        if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
      } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_qualarr)) __pyx_t_12 = 0;
      if (unlikely(__pyx_t_12 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_12);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qualarr.buf, __pyx_t_11, __pyx_bstride_0_qualarr) = ((__pyx_v_qualstr[__pyx_v_i]) - 33);
    }
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":792
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 33
 *       elif self._qualscale == "solexa":             # <<<<<<<<<<<<<<
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 64
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->_qualscale), ((PyObject *)__pyx_n_s__solexa), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":793
 *             qualarr[i] = qualstr[i] - 33
 *       elif self._qualscale == "solexa":
 *          for i in xrange( seq_len ):             # <<<<<<<<<<<<<<
 *             qualarr[i] = qualstr[i] - 64
 *       elif self._qualscale == "solexa-old":
 */
    __pyx_t_9 = __pyx_v_seq_len;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":794
 *       elif self._qualscale == "solexa":
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 64             # <<<<<<<<<<<<<<
 *       elif self._qualscale == "solexa-old":
 *          for i in xrange( seq_len ):
 */
      __pyx_t_12 = __pyx_v_i;
      __pyx_t_13 = -1;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_bshape_0_qualarr;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
      } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_qualarr)) __pyx_t_13 = 0;
      if (unlikely(__pyx_t_13 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_13);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qualarr.buf, __pyx_t_12, __pyx_bstride_0_qualarr) = ((__pyx_v_qualstr[__pyx_v_i]) - 64);
    }
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":795
 *          for i in xrange( seq_len ):
 *             qualarr[i] = qualstr[i] - 64
 *       elif self._qualscale == "solexa-old":             # <<<<<<<<<<<<<<
 *          for i in xrange( seq_len ):
 *             qualarr[i] = 10 * math.log10( 1 + 10 ** ( qualstr[i] - 64 ) / 10.0 )
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_self->_qualscale), ((PyObject *)__pyx_kp_s_60), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":796
 *             qualarr[i] = qualstr[i] - 64
 *       elif self._qualscale == "solexa-old":
 *          for i in xrange( seq_len ):             # <<<<<<<<<<<<<<
 *             qualarr[i] = 10 * math.log10( 1 + 10 ** ( qualstr[i] - 64 ) / 10.0 )
 *       else:
 */
    __pyx_t_9 = __pyx_v_seq_len;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;

      /* "HTSeq/_HTSeq.pyx":797
 *       elif self._qualscale == "solexa-old":
 *          for i in xrange( seq_len ):
 *             qualarr[i] = 10 * math.log10( 1 + 10 ** ( qualstr[i] - 64 ) / 10.0 )             # <<<<<<<<<<<<<<
 *       else:
 *          raise ValueError, "Illegal quality scale '%s'." % self._qualscale
 */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__log10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyFloat_FromDouble((1.0 + (__Pyx_pow_long(10, ((__pyx_v_qualstr[__pyx_v_i]) - 64)) / 10.0))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __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_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Multiply(__pyx_int_10, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_14 = __Pyx_PyInt_from_py_npy_long(__pyx_t_4); if (unlikely((__pyx_t_14 == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __pyx_v_i;
      __pyx_t_15 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_bshape_0_qualarr;
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_qualarr)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qualarr.buf, __pyx_t_13, __pyx_bstride_0_qualarr) = __pyx_t_14;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":799
 *             qualarr[i] = 10 * math.log10( 1 + 10 ** ( qualstr[i] - 64 ) / 10.0 )
 *       else:
 *          raise ValueError, "Illegal quality scale '%s'." % self._qualscale             # <<<<<<<<<<<<<<
 *       self._qualarr = qualarr
 * 
 */
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_61), ((PyObject *)__pyx_v_self->_qualscale)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), 0, 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":800
 *       else:
 *          raise ValueError, "Illegal quality scale '%s'." % self._qualscale
 *       self._qualarr = qualarr             # <<<<<<<<<<<<<<
 * 
 *    property qual:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_qualarr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_qualarr));
  __Pyx_GOTREF(__pyx_v_self->_qualarr);
  __Pyx_DECREF(__pyx_v_self->_qualarr);
  __pyx_v_self->_qualarr = ((PyObject *)__pyx_v_qualarr);

  __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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qualarr);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities._fill_qual_arr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qualarr);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_qualarr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":803
 * 
 *    property qual:
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          if self._qualarr is None:
 *             self._fill_qual_arr()
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__");

  /* "HTSeq/_HTSeq.pyx":804
 *    property qual:
 *       def __get__( self ):
 *          if self._qualarr is None:             # <<<<<<<<<<<<<<
 *             self._fill_qual_arr()
 *          return self._qualarr
 */
  __pyx_t_1 = (((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr == Py_None);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":805
 *       def __get__( self ):
 *          if self._qualarr is None:
 *             self._fill_qual_arr()             # <<<<<<<<<<<<<<
 *          return self._qualarr
 *       def __set__( self, newvalue ):
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_fill_qual_arr(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":806
 *          if self._qualarr is None:
 *             self._fill_qual_arr()
 *          return self._qualarr             # <<<<<<<<<<<<<<
 *       def __set__( self, newvalue ):
 *          if not ( isinstance( newvalue, numpy.ndarray ) and newvalue.dtype == numpy.int ) :
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":807
 *             self._fill_qual_arr()
 *          return self._qualarr
 *       def __set__( self, newvalue ):             # <<<<<<<<<<<<<<
 *          if not ( isinstance( newvalue, numpy.ndarray ) and newvalue.dtype == numpy.int ) :
 *             raise TypeError, "qual can only be assigned a numpy array of type numpy.int"
 */

static int __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_newvalue); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_newvalue) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");

  /* "HTSeq/_HTSeq.pyx":808
 *          return self._qualarr
 *       def __set__( self, newvalue ):
 *          if not ( isinstance( newvalue, numpy.ndarray ) and newvalue.dtype == numpy.int ) :             # <<<<<<<<<<<<<<
 *             raise TypeError, "qual can only be assigned a numpy array of type numpy.int"
 *          if not ( newvalue.shape == ( len(self.seq), ) ) :
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_newvalue, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_newvalue, __pyx_n_s__dtype); 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_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); 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_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __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_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  __pyx_t_2 = (!__pyx_t_6);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":809
 *       def __set__( self, newvalue ):
 *          if not ( isinstance( newvalue, numpy.ndarray ) and newvalue.dtype == numpy.int ) :
 *             raise TypeError, "qual can only be assigned a numpy array of type numpy.int"             # <<<<<<<<<<<<<<
 *          if not ( newvalue.shape == ( len(self.seq), ) ) :
 *             raise TypeError, "assignment to qual with illegal shape"
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_62), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":810
 *          if not ( isinstance( newvalue, numpy.ndarray ) and newvalue.dtype == numpy.int ) :
 *             raise TypeError, "qual can only be assigned a numpy array of type numpy.int"
 *          if not ( newvalue.shape == ( len(self.seq), ) ) :             # <<<<<<<<<<<<<<
 *             raise TypeError, "assignment to qual with illegal shape"
 *          self._qualarr = newvalue
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_newvalue, __pyx_n_s__shape); 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_t_4 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.seq);
  __Pyx_INCREF(__pyx_t_4);
  if (unlikely(__pyx_t_4 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_7 = PyBytes_GET_SIZE(__pyx_t_4); 
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_t_1), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __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_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = (!__pyx_t_2);
  if (__pyx_t_6) {

    /* "HTSeq/_HTSeq.pyx":811
 *             raise TypeError, "qual can only be assigned a numpy array of type numpy.int"
 *          if not ( newvalue.shape == ( len(self.seq), ) ) :
 *             raise TypeError, "assignment to qual with illegal shape"             # <<<<<<<<<<<<<<
 *          self._qualarr = newvalue
 *          self._qualstr = b""
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_63), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":812
 *          if not ( newvalue.shape == ( len(self.seq), ) ) :
 *             raise TypeError, "assignment to qual with illegal shape"
 *          self._qualarr = newvalue             # <<<<<<<<<<<<<<
 *          self._qualstr = b""
 *          self._qualscale = "none"
 */
  __Pyx_INCREF(__pyx_v_newvalue);
  __Pyx_GIVEREF(__pyx_v_newvalue);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  __Pyx_DECREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr = __pyx_v_newvalue;

  /* "HTSeq/_HTSeq.pyx":813
 *             raise TypeError, "assignment to qual with illegal shape"
 *          self._qualarr = newvalue
 *          self._qualstr = b""             # <<<<<<<<<<<<<<
 *          self._qualscale = "none"
 *          self._qualstr_phred = b""
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr = __pyx_kp_b_14;

  /* "HTSeq/_HTSeq.pyx":814
 *          self._qualarr = newvalue
 *          self._qualstr = b""
 *          self._qualscale = "none"             # <<<<<<<<<<<<<<
 *          self._qualstr_phred = b""
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_n_s__none));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__none));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale = __pyx_n_s__none;

  /* "HTSeq/_HTSeq.pyx":815
 *          self._qualstr = b""
 *          self._qualscale = "none"
 *          self._qualstr_phred = b""             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_14));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred = __pyx_kp_b_14;

  __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_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":817
 *          self._qualstr_phred = b""
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       return "<%s object '%s'>" % ( self.__class__.__name__, self.name )
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_1__repr__(PyObject *__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("__repr__");

  /* "HTSeq/_HTSeq.pyx":818
 * 
 *    def __repr__( self ):
 *       return "<%s object '%s'>" % ( self.__class__.__name__, self.name )             # <<<<<<<<<<<<<<
 * 
 *    def __getitem__( self, item ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); 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_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_64), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__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("HTSeq._HTSeq.SequenceWithQualities.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":820
 *       return "<%s object '%s'>" % ( self.__class__.__name__, self.name )
 * 
 *    def __getitem__( self, item ):             # <<<<<<<<<<<<<<
 *       if self.name.endswith( "[part]" ):
 *          new_name = self.name
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_2__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_v_new_name = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__");

  /* "HTSeq/_HTSeq.pyx":821
 * 
 *    def __getitem__( self, item ):
 *       if self.name.endswith( "[part]" ):             # <<<<<<<<<<<<<<
 *          new_name = self.name
 *       else:
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = __Pyx_PyStr_Tailmatch(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name), ((PyObject *)__pyx_kp_s_49), 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":822
 *    def __getitem__( self, item ):
 *       if self.name.endswith( "[part]" ):
 *          new_name = self.name             # <<<<<<<<<<<<<<
 *       else:
 *          new_name = self.name + "[part]"
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
    __pyx_v_new_name = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name);
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":824
 *          new_name = self.name
 *       else:
 *          new_name = self.name + "[part]"             # <<<<<<<<<<<<<<
 *       return SequenceWithQualities(
 *          self.seq[ item ], new_name, self.qualstr[ item ] )
 */
    __pyx_t_2 = PyNumber_Add(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name), ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_v_new_name = ((PyObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":825
 *       else:
 *          new_name = self.name + "[part]"
 *       return SequenceWithQualities(             # <<<<<<<<<<<<<<
 *          self.seq[ item ], new_name, self.qualstr[ item ] )
 * 
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":826
 *          new_name = self.name + "[part]"
 *       return SequenceWithQualities(
 *          self.seq[ item ], new_name, self.qualstr[ item ] )             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
  __pyx_t_2 = PyObject_GetItem(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.seq), __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qualstr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_v_item); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_new_name);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_new_name);
  __Pyx_GIVEREF(__pyx_v_new_name);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":829
 * 
 *    @property
 *    def qualstr( self ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen
 *       cdef char * qualstr_phred_cstr = self._qualstr_phred
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_3qualstr(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_3qualstr(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  int __pyx_v_seqlen;
  char *__pyx_v_qualstr_phred_cstr;
  int __pyx_v_i;
  PyArrayObject *__pyx_v_qual_array = 0;
  Py_buffer __pyx_bstruct_qual_array;
  Py_ssize_t __pyx_bstride_0_qual_array = 0;
  Py_ssize_t __pyx_bshape_0_qual_array = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  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("qualstr");
  __pyx_bstruct_qual_array.buf = NULL;

  /* "HTSeq/_HTSeq.pyx":831
 *    def qualstr( self ):
 *       cdef int seqlen
 *       cdef char * qualstr_phred_cstr = self._qualstr_phred             # <<<<<<<<<<<<<<
 *       cdef int i
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array
 */
  __pyx_t_1 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_qualstr_phred_cstr = __pyx_t_1;

  /* "HTSeq/_HTSeq.pyx":834
 *       cdef int i
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array
 *       if qualstr_phred_cstr[0] == 0:             # <<<<<<<<<<<<<<
 *          if self._qualscale == "noquals":
 *             raise ValueError, "Quality string missing"
 */
  __pyx_t_2 = ((__pyx_v_qualstr_phred_cstr[0]) == 0);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":835
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array
 *       if qualstr_phred_cstr[0] == 0:
 *          if self._qualscale == "noquals":             # <<<<<<<<<<<<<<
 *             raise ValueError, "Quality string missing"
 *          if self._qualscale == "phred":
 */
    __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale), ((PyObject *)__pyx_n_s__noquals), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":836
 *       if qualstr_phred_cstr[0] == 0:
 *          if self._qualscale == "noquals":
 *             raise ValueError, "Quality string missing"             # <<<<<<<<<<<<<<
 *          if self._qualscale == "phred":
 *             self._qualstr_phred = self._qualstr
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_65), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "HTSeq/_HTSeq.pyx":837
 *          if self._qualscale == "noquals":
 *             raise ValueError, "Quality string missing"
 *          if self._qualscale == "phred":             # <<<<<<<<<<<<<<
 *             self._qualstr_phred = self._qualstr
 *          else:
 */
    __pyx_t_2 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale), ((PyObject *)__pyx_n_s__phred), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_2) {

      /* "HTSeq/_HTSeq.pyx":838
 *             raise ValueError, "Quality string missing"
 *          if self._qualscale == "phred":
 *             self._qualstr_phred = self._qualstr             # <<<<<<<<<<<<<<
 *          else:
 *             seqlen = len( self.seq )
 */
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
      __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
      ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":840
 *             self._qualstr_phred = self._qualstr
 *          else:
 *             seqlen = len( self.seq )             # <<<<<<<<<<<<<<
 *             self._qualstr_phred = <bytes>(' ') * seqlen
 *             qualstr_phred_cstr = self._qualstr_phred
 */
      __pyx_t_3 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.seq);
      __Pyx_INCREF(__pyx_t_3);
      if (unlikely(__pyx_t_3 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_3); 
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_seqlen = __pyx_t_4;

      /* "HTSeq/_HTSeq.pyx":841
 *          else:
 *             seqlen = len( self.seq )
 *             self._qualstr_phred = <bytes>(' ') * seqlen             # <<<<<<<<<<<<<<
 *             qualstr_phred_cstr = self._qualstr_phred
 *             if self._qualarr is None:
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_seqlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_66), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
      ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "HTSeq/_HTSeq.pyx":842
 *             seqlen = len( self.seq )
 *             self._qualstr_phred = <bytes>(' ') * seqlen
 *             qualstr_phred_cstr = self._qualstr_phred             # <<<<<<<<<<<<<<
 *             if self._qualarr is None:
 *                self._fill_qual_arr()
 */
      __pyx_t_1 = PyBytes_AsString(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_qualstr_phred_cstr = __pyx_t_1;

      /* "HTSeq/_HTSeq.pyx":843
 *             self._qualstr_phred = <bytes>(' ') * seqlen
 *             qualstr_phred_cstr = self._qualstr_phred
 *             if self._qualarr is None:             # <<<<<<<<<<<<<<
 *                self._fill_qual_arr()
 *             qual_array = self._qualarr
 */
      __pyx_t_2 = (((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr == Py_None);
      if (__pyx_t_2) {

        /* "HTSeq/_HTSeq.pyx":844
 *             qualstr_phred_cstr = self._qualstr_phred
 *             if self._qualarr is None:
 *                self._fill_qual_arr()             # <<<<<<<<<<<<<<
 *             qual_array = self._qualarr
 *             for i in xrange( seqlen ):
 */
        __pyx_t_5 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->_fill_qual_arr(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "HTSeq/_HTSeq.pyx":845
 *             if self._qualarr is None:
 *                self._fill_qual_arr()
 *             qual_array = self._qualarr             # <<<<<<<<<<<<<<
 *             for i in xrange( seqlen ):
 *                qualstr_phred_cstr[i] = 33 + qual_array[i]
 */
      if (!(likely(((((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_qual_array, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_7 < 0)) {
          PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_qual_array, (PyObject*)__pyx_v_qual_array, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
          }
        }
        __pyx_bstride_0_qual_array = __pyx_bstruct_qual_array.strides[0];
        __pyx_bshape_0_qual_array = __pyx_bstruct_qual_array.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __Pyx_INCREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
      __pyx_v_qual_array = ((PyArrayObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);

      /* "HTSeq/_HTSeq.pyx":846
 *                self._fill_qual_arr()
 *             qual_array = self._qualarr
 *             for i in xrange( seqlen ):             # <<<<<<<<<<<<<<
 *                qualstr_phred_cstr[i] = 33 + qual_array[i]
 *       return self._qualstr_phred
 */
      __pyx_t_7 = __pyx_v_seqlen;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_7; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

        /* "HTSeq/_HTSeq.pyx":847
 *             qual_array = self._qualarr
 *             for i in xrange( seqlen ):
 *                qualstr_phred_cstr[i] = 33 + qual_array[i]             # <<<<<<<<<<<<<<
 *       return self._qualstr_phred
 * 
 */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_13 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_qual_array;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_qual_array)) __pyx_t_13 = 0;
        if (unlikely(__pyx_t_13 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_13);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        (__pyx_v_qualstr_phred_cstr[__pyx_v_i]) = (33 + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qual_array.buf, __pyx_t_12, __pyx_bstride_0_qual_array)));
      }
    }
    __pyx_L7:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":848
 *             for i in xrange( seqlen ):
 *                qualstr_phred_cstr[i] = 33 + qual_array[i]
 *       return self._qualstr_phred             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.qualstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_qual_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":851
 * 
 * 
 *    def write_to_fastq_file( self, fastq_file ):             # <<<<<<<<<<<<<<
 *       if hasattr( self, "descr" ) and self.descr is not None:
 *          fastq_file.write( "@%s %s\n" % ( self.name, self.descr ) )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4write_to_fastq_file(PyObject *__pyx_v_self, PyObject *__pyx_v_fastq_file); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4write_to_fastq_file(PyObject *__pyx_v_self, PyObject *__pyx_v_fastq_file) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  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("write_to_fastq_file");

  /* "HTSeq/_HTSeq.pyx":852
 * 
 *    def write_to_fastq_file( self, fastq_file ):
 *       if hasattr( self, "descr" ) and self.descr is not None:             # <<<<<<<<<<<<<<
 *          fastq_file.write( "@%s %s\n" % ( self.name, self.descr ) )
 *       else:
 */
  __pyx_t_1 = ((PyObject *)__pyx_n_s__descr);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_HasAttr(__pyx_v_self, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_t_3 = (((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.descr != ((PyObject*)Py_None));
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":853
 *    def write_to_fastq_file( self, fastq_file ):
 *       if hasattr( self, "descr" ) and self.descr is not None:
 *          fastq_file.write( "@%s %s\n" % ( self.name, self.descr ) )             # <<<<<<<<<<<<<<
 *       else:
 *          fastq_file.write( "@%s\n" % self.name )
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_fastq_file, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.descr));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.descr));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.descr));
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __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 = 853; __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;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":855
 *          fastq_file.write( "@%s %s\n" % ( self.name, self.descr ) )
 *       else:
 *          fastq_file.write( "@%s\n" % self.name )             # <<<<<<<<<<<<<<
 *       fastq_file.write( self.seq + "\n" )
 *       fastq_file.write( "+\n" )
 */
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_fastq_file, __pyx_n_s__write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_68), ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.name)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":856
 *       else:
 *          fastq_file.write( "@%s\n" % self.name )
 *       fastq_file.write( self.seq + "\n" )             # <<<<<<<<<<<<<<
 *       fastq_file.write( "+\n" )
 *       fastq_file.write( self.qualstr + "\n" )
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_fastq_file, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Add(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.seq), ((PyObject *)__pyx_kp_s_52)); 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_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); 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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":857
 *          fastq_file.write( "@%s\n" % self.name )
 *       fastq_file.write( self.seq + "\n" )
 *       fastq_file.write( "+\n" )             # <<<<<<<<<<<<<<
 *       fastq_file.write( self.qualstr + "\n" )
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_fastq_file, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "HTSeq/_HTSeq.pyx":858
 *       fastq_file.write( self.seq + "\n" )
 *       fastq_file.write( "+\n" )
 *       fastq_file.write( self.qualstr + "\n" )             # <<<<<<<<<<<<<<
 * 
 *    def get_fastq_str( self, bint convert_to_phred=False ):
 */
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_fastq_file, __pyx_n_s__write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__qualstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_52)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __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 = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.write_to_fastq_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":860
 *       fastq_file.write( self.qualstr + "\n" )
 * 
 *    def get_fastq_str( self, bint convert_to_phred=False ):             # <<<<<<<<<<<<<<
 *       sio = cStringIO.StringIO()
 *       self.write_to_fastq_file( sio, convert_to_phred )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_5get_fastq_str(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_5get_fastq_str(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_convert_to_phred;
  PyObject *__pyx_v_sio = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__convert_to_phred,0};
  __Pyx_RefNannySetupContext("get_fastq_str");
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__convert_to_phred);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "get_fastq_str") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_convert_to_phred = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_convert_to_phred == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_convert_to_phred = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_fastq_str", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.get_fastq_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":861
 * 
 *    def get_fastq_str( self, bint convert_to_phred=False ):
 *       sio = cStringIO.StringIO()             # <<<<<<<<<<<<<<
 *       self.write_to_fastq_file( sio, convert_to_phred )
 *       return sio.getvalue()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__cStringIO); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__StringIO); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __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 = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_sio = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":862
 *    def get_fastq_str( self, bint convert_to_phred=False ):
 *       sio = cStringIO.StringIO()
 *       self.write_to_fastq_file( sio, convert_to_phred )             # <<<<<<<<<<<<<<
 *       return sio.getvalue()
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__write_to_fastq_file); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_convert_to_phred); 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_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_sio);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_sio);
  __Pyx_GIVEREF(__pyx_v_sio);
  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 = 862; __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;

  /* "HTSeq/_HTSeq.pyx":863
 *       sio = cStringIO.StringIO()
 *       self.write_to_fastq_file( sio, convert_to_phred )
 *       return sio.getvalue()             # <<<<<<<<<<<<<<
 * 
 *    cpdef SequenceWithQualities get_reverse_complement( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_sio, __pyx_n_s__getvalue); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __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 = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__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("HTSeq._HTSeq.SequenceWithQualities.get_fastq_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sio);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":865
 *       return sio.getvalue()
 * 
 *    cpdef SequenceWithQualities get_reverse_complement( self ):             # <<<<<<<<<<<<<<
 *       cdef SequenceWithQualities res
 *       res = SequenceWithQualities(
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_6get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_get_reverse_complement(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, int __pyx_skip_dispatch) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_res = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_reverse_complement");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_47); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_6get_reverse_complement)) {
      __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 = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":868
 *       cdef SequenceWithQualities res
 *       res = SequenceWithQualities(
 *          reverse_complement( self.seq ),             # <<<<<<<<<<<<<<
 *          "revcomp_of_" + self.name,
 *          self._qualstr[::-1],
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->seq);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_reverse_complement(((PyObject*)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":869
 *       res = SequenceWithQualities(
 *          reverse_complement( self.seq ),
 *          "revcomp_of_" + self.name,             # <<<<<<<<<<<<<<
 *          self._qualstr[::-1],
 *          self._qualscale )
 */
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_n_s__revcomp_of_), ((PyObject *)__pyx_v_self->name)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "HTSeq/_HTSeq.pyx":870
 *          reverse_complement( self.seq ),
 *          "revcomp_of_" + self.name,
 *          self._qualstr[::-1],             # <<<<<<<<<<<<<<
 *          self._qualscale )
 *       if self._qualarr is not None:
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___qualstr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_k_slice_71); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":871
 *          "revcomp_of_" + self.name,
 *          self._qualstr[::-1],
 *          self._qualscale )             # <<<<<<<<<<<<<<
 *       if self._qualarr is not None:
 *          res._qualarr = self._qualarr[::-1]
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___qualscale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_res = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":872
 *          self._qualstr[::-1],
 *          self._qualscale )
 *       if self._qualarr is not None:             # <<<<<<<<<<<<<<
 *          res._qualarr = self._qualarr[::-1]
 *       return res
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___qualarr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = (__pyx_t_3 != Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "HTSeq/_HTSeq.pyx":873
 *          self._qualscale )
 *       if self._qualarr is not None:
 *          res._qualarr = self._qualarr[::-1]             # <<<<<<<<<<<<<<
 *       return res
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s___qualarr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_k_slice_72); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_res->_qualarr);
    __Pyx_DECREF(__pyx_v_res->_qualarr);
    __pyx_v_res->_qualarr = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":874
 *       if self._qualarr is not None:
 *          res._qualarr = self._qualarr[::-1]
 *       return res             # <<<<<<<<<<<<<<
 * 
 *    cpdef object add_qual_to_count_array( SequenceWithQualities self,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)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_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.get_reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":865
 *       return sio.getvalue()
 * 
 *    cpdef SequenceWithQualities get_reverse_complement( self ):             # <<<<<<<<<<<<<<
 *       cdef SequenceWithQualities res
 *       res = SequenceWithQualities(
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_6get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_6get_reverse_complement(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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_reverse_complement");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->get_reverse_complement(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __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("HTSeq._HTSeq.SequenceWithQualities.get_reverse_complement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_get_reverse_complement__pyx_wrap_1(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_self, int __pyx_skip_dispatch) {
  return __pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_get_reverse_complement(__pyx_v_self, __pyx_skip_dispatch);
}

/* "HTSeq/_HTSeq.pyx":876
 *       return res
 * 
 *    cpdef object add_qual_to_count_array( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          numpy.ndarray count_array_ ):
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_7add_qual_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_add_qual_to_count_array(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_self, PyArrayObject *__pyx_v_count_array_, int __pyx_skip_dispatch) {
  PyArrayObject *__pyx_v_count_array = 0;
  PyArrayObject *__pyx_v_qual_array = 0;
  npy_intp __pyx_v_seq_length;
  npy_intp __pyx_v_qual_size;
  npy_intp __pyx_v_i;
  npy_int __pyx_v_q;
  Py_buffer __pyx_bstruct_count_array;
  Py_ssize_t __pyx_bstride_0_count_array = 0;
  Py_ssize_t __pyx_bstride_1_count_array = 0;
  Py_ssize_t __pyx_bshape_0_count_array = 0;
  Py_ssize_t __pyx_bshape_1_count_array = 0;
  Py_buffer __pyx_bstruct_qual_array;
  Py_ssize_t __pyx_bstride_0_qual_array = 0;
  Py_ssize_t __pyx_bshape_0_qual_array = 0;
  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;
  PyArrayObject *__pyx_t_5 = NULL;
  npy_intp __pyx_t_6;
  npy_intp __pyx_t_7;
  npy_intp __pyx_t_8;
  int __pyx_t_9;
  npy_intp __pyx_t_10;
  npy_int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_qual_to_count_array");
  __pyx_bstruct_count_array.buf = NULL;
  __pyx_bstruct_qual_array.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_73); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_7add_qual_to_count_array)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_count_array_));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_count_array_));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_count_array_));
      __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 = 876; __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;
  }

  /* "HTSeq/_HTSeq.pyx":879
 *          numpy.ndarray count_array_ ):
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_             # <<<<<<<<<<<<<<
 *       if self._qualarr is None:
 *          self._fill_qual_arr()
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_count_array, (PyObject*)((PyArrayObject *)__pyx_v_count_array_), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_count_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_count_array.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_count_array = __pyx_bstruct_count_array.strides[0]; __pyx_bstride_1_count_array = __pyx_bstruct_count_array.strides[1];
      __pyx_bshape_0_count_array = __pyx_bstruct_count_array.shape[0]; __pyx_bshape_1_count_array = __pyx_bstruct_count_array.shape[1];
    }
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_count_array_));
  __pyx_v_count_array = ((PyArrayObject *)__pyx_v_count_array_);

  /* "HTSeq/_HTSeq.pyx":880
 * 
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_
 *       if self._qualarr is None:             # <<<<<<<<<<<<<<
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 */
  __pyx_t_4 = (__pyx_v_self->_qualarr == Py_None);
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":881
 *       cdef numpy.ndarray[ numpy.int_t, ndim=2 ] count_array = count_array_
 *       if self._qualarr is None:
 *          self._fill_qual_arr()             # <<<<<<<<<<<<<<
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 * 
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fill_qual_arr(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":882
 *       if self._qualarr is None:
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr             # <<<<<<<<<<<<<<
 * 
 *       cdef numpy.npy_intp seq_length = numpy.PyArray_DIMS( qual_array  )[0]
 */
  if (!(likely(((__pyx_v_self->_qualarr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->_qualarr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->_qualarr);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_qual_array, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_qual_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_qual_array.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_qual_array = __pyx_bstruct_qual_array.strides[0];
      __pyx_bshape_0_qual_array = __pyx_bstruct_qual_array.shape[0];
    }
  }
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_v_self->_qualarr);
  __pyx_v_qual_array = ((PyArrayObject *)__pyx_v_self->_qualarr);

  /* "HTSeq/_HTSeq.pyx":884
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 * 
 *       cdef numpy.npy_intp seq_length = numpy.PyArray_DIMS( qual_array  )[0]             # <<<<<<<<<<<<<<
 *       cdef numpy.npy_intp qual_size  = numpy.PyArray_DIMS( count_array )[1]
 * 
 */
  __pyx_v_seq_length = (PyArray_DIMS(((PyArrayObject *)__pyx_v_qual_array))[0]);

  /* "HTSeq/_HTSeq.pyx":885
 * 
 *       cdef numpy.npy_intp seq_length = numpy.PyArray_DIMS( qual_array  )[0]
 *       cdef numpy.npy_intp qual_size  = numpy.PyArray_DIMS( count_array )[1]             # <<<<<<<<<<<<<<
 * 
 *       if seq_length > numpy.PyArray_DIMS( count_array )[0]:
 */
  __pyx_v_qual_size = (PyArray_DIMS(((PyArrayObject *)__pyx_v_count_array))[1]);

  /* "HTSeq/_HTSeq.pyx":887
 *       cdef numpy.npy_intp qual_size  = numpy.PyArray_DIMS( count_array )[1]
 * 
 *       if seq_length > numpy.PyArray_DIMS( count_array )[0]:             # <<<<<<<<<<<<<<
 *          raise ValueError, "'count_array' too small for sequence."
 * 
 */
  __pyx_t_4 = (__pyx_v_seq_length > (PyArray_DIMS(((PyArrayObject *)__pyx_v_count_array))[0]));
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":888
 * 
 *       if seq_length > numpy.PyArray_DIMS( count_array )[0]:
 *          raise ValueError, "'count_array' too small for sequence."             # <<<<<<<<<<<<<<
 * 
 *       cdef numpy.npy_intp i
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_54), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":892
 *       cdef numpy.npy_intp i
 *       cdef numpy.npy_int q
 *       for i in xrange( seq_length ):             # <<<<<<<<<<<<<<
 *          q = qual_array[i]
 *          if( q >= qual_size ):
 */
  __pyx_t_6 = __pyx_v_seq_length;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "HTSeq/_HTSeq.pyx":893
 *       cdef numpy.npy_int q
 *       for i in xrange( seq_length ):
 *          q = qual_array[i]             # <<<<<<<<<<<<<<
 *          if( q >= qual_size ):
 *             raise ValueError, "Too large quality value encountered."
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_9 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_bshape_0_qual_array;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_qual_array)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_q = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qual_array.buf, __pyx_t_8, __pyx_bstride_0_qual_array));

    /* "HTSeq/_HTSeq.pyx":894
 *       for i in xrange( seq_length ):
 *          q = qual_array[i]
 *          if( q >= qual_size ):             # <<<<<<<<<<<<<<
 *             raise ValueError, "Too large quality value encountered."
 *          count_array[ i, q ] += 1
 */
    __pyx_t_4 = (__pyx_v_q >= __pyx_v_qual_size);
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":895
 *          q = qual_array[i]
 *          if( q >= qual_size ):
 *             raise ValueError, "Too large quality value encountered."             # <<<<<<<<<<<<<<
 *          count_array[ i, q ] += 1
 * 
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_74), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":896
 *          if( q >= qual_size ):
 *             raise ValueError, "Too large quality value encountered."
 *          count_array[ i, q ] += 1             # <<<<<<<<<<<<<<
 * 
 *       return None
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __pyx_v_q;
    __pyx_t_9 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_bshape_0_count_array;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_count_array)) __pyx_t_9 = 0;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_bshape_1_count_array;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
    } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_count_array)) __pyx_t_9 = 1;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int_t *, __pyx_bstruct_count_array.buf, __pyx_t_10, __pyx_bstride_0_count_array, __pyx_t_11, __pyx_bstride_1_count_array) += 1;
  }

  /* "HTSeq/_HTSeq.pyx":898
 *          count_array[ i, q ] += 1
 * 
 *       return None             # <<<<<<<<<<<<<<
 * 
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count_array);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.add_qual_to_count_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_count_array);
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_count_array);
  __Pyx_XDECREF((PyObject *)__pyx_v_qual_array);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":876
 *       return res
 * 
 *    cpdef object add_qual_to_count_array( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          numpy.ndarray count_array_ ):
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_7add_qual_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_7add_qual_to_count_array(PyObject *__pyx_v_self, PyObject *__pyx_v_count_array_) {
  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("add_qual_to_count_array");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_count_array_), __pyx_ptype_5numpy_ndarray, 1, "count_array_", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->add_qual_to_count_array(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self), ((PyArrayObject *)__pyx_v_count_array_), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __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("HTSeq._HTSeq.SequenceWithQualities.add_qual_to_count_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":900
 *       return None
 * 
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8trim_left_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals *__pyx_optional_args) {
  int __pyx_v_max_mm_qual = ((int)5);
  int __pyx_v_seqlen;
  int __pyx_v_patlen;
  int __pyx_v_minlen;
  char *__pyx_v_seq_cstr;
  char *__pyx_v_pat_cstr;
  int __pyx_v_match;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_sum_mm_qual;
  PyArrayObject *__pyx_v_qual_array = 0;
  long __pyx_v_num_mismatches;
  Py_buffer __pyx_bstruct_qual_array;
  Py_ssize_t __pyx_bstride_0_qual_array = 0;
  Py_ssize_t __pyx_bshape_0_qual_array = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  PyArrayObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  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("trim_left_end_with_quals");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_max_mm_qual = __pyx_optional_args->max_mm_qual;
    }
  }
  __pyx_bstruct_qual_array.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_75); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8trim_left_end_with_quals)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyInt_FromLong(__pyx_v_max_mm_qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
      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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":902
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,
 *          Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )             # <<<<<<<<<<<<<<
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seqlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":903
 *          Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )             # <<<<<<<<<<<<<<
 *       cdef int minlen
 *       if seqlen < patlen:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_pattern->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_patlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":905
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 *       if seqlen < patlen:             # <<<<<<<<<<<<<<
 *          minlen = seqlen
 *       else:
 */
  __pyx_t_5 = (__pyx_v_seqlen < __pyx_v_patlen);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":906
 *       cdef int minlen
 *       if seqlen < patlen:
 *          minlen = seqlen             # <<<<<<<<<<<<<<
 *       else:
 *          minlen = patlen
 */
    __pyx_v_minlen = __pyx_v_seqlen;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":908
 *          minlen = seqlen
 *       else:
 *          minlen = patlen             # <<<<<<<<<<<<<<
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 */
    __pyx_v_minlen = __pyx_v_patlen;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":909
 *       else:
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq             # <<<<<<<<<<<<<<
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->__pyx_base.seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seq_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":910
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq             # <<<<<<<<<<<<<<
 *       cdef int match = 0
 *       cdef int i, j
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_pattern->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pat_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":911
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0             # <<<<<<<<<<<<<<
 *       cdef int i, j
 *       cdef int sum_mm_qual
 */
  __pyx_v_match = 0;

  /* "HTSeq/_HTSeq.pyx":914
 *       cdef int i, j
 *       cdef int sum_mm_qual
 *       if self._qualarr is None:             # <<<<<<<<<<<<<<
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 */
  __pyx_t_5 = (__pyx_v_self->_qualarr == Py_None);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":915
 *       cdef int sum_mm_qual
 *       if self._qualarr is None:
 *          self._fill_qual_arr()             # <<<<<<<<<<<<<<
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fill_qual_arr(__pyx_v_self); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":916
 *       if self._qualarr is None:
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr             # <<<<<<<<<<<<<<
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0
 */
  if (!(likely(((__pyx_v_self->_qualarr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->_qualarr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->_qualarr);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_qual_array, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_qual_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_qual_array.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_qual_array = __pyx_bstruct_qual_array.strides[0];
      __pyx_bshape_0_qual_array = __pyx_bstruct_qual_array.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __Pyx_INCREF(__pyx_v_self->_qualarr);
  __pyx_v_qual_array = ((PyArrayObject *)__pyx_v_self->_qualarr);

  /* "HTSeq/_HTSeq.pyx":917
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):             # <<<<<<<<<<<<<<
 *          num_mismatches = 0
 *          for j in xrange( i ):
 */
  __pyx_t_8 = (__pyx_v_minlen + 1);
  for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "HTSeq/_HTSeq.pyx":918
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0             # <<<<<<<<<<<<<<
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 */
    __pyx_v_num_mismatches = 0;

    /* "HTSeq/_HTSeq.pyx":919
 *       for i in xrange( 1, minlen+1 ):
 *          num_mismatches = 0
 *          for j in xrange( i ):             # <<<<<<<<<<<<<<
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                sum_mm_qual += qual_array[ j ]
 */
    __pyx_t_10 = __pyx_v_i;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_j = __pyx_t_11;

      /* "HTSeq/_HTSeq.pyx":920
 *          num_mismatches = 0
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:             # <<<<<<<<<<<<<<
 *                sum_mm_qual += qual_array[ j ]
 *                if sum_mm_qual > max_mm_qual:
 */
      __pyx_t_5 = ((__pyx_v_seq_cstr[__pyx_v_j]) != (__pyx_v_pat_cstr[((__pyx_v_patlen - __pyx_v_i) + __pyx_v_j)]));
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":921
 *          for j in xrange( i ):
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                sum_mm_qual += qual_array[ j ]             # <<<<<<<<<<<<<<
 *                if sum_mm_qual > max_mm_qual:
 *                   break
 */
        __pyx_t_12 = __pyx_v_j;
        __pyx_t_13 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_qual_array;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_qual_array)) __pyx_t_13 = 0;
        if (unlikely(__pyx_t_13 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_13);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_sum_mm_qual = (__pyx_v_sum_mm_qual + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qual_array.buf, __pyx_t_12, __pyx_bstride_0_qual_array)));

        /* "HTSeq/_HTSeq.pyx":922
 *             if seq_cstr[ j ] != pat_cstr[ patlen - i + j ]:
 *                sum_mm_qual += qual_array[ j ]
 *                if sum_mm_qual > max_mm_qual:             # <<<<<<<<<<<<<<
 *                   break
 *          else:
 */
        __pyx_t_5 = (__pyx_v_sum_mm_qual > __pyx_v_max_mm_qual);
        if (__pyx_t_5) {

          /* "HTSeq/_HTSeq.pyx":923
 *                sum_mm_qual += qual_array[ j ]
 *                if sum_mm_qual > max_mm_qual:
 *                   break             # <<<<<<<<<<<<<<
 *          else:
 *             match = i
 */
          goto __pyx_L8_break;
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":925
 *                   break
 *          else:
 *             match = i             # <<<<<<<<<<<<<<
 *       return self[ match : seqlen ]
 * 
 */
      __pyx_v_match = __pyx_v_i;
    }
    __pyx_L8_break:;
  }

  /* "HTSeq/_HTSeq.pyx":926
 *          else:
 *             match = i
 *       return self[ match : seqlen ]             # <<<<<<<<<<<<<<
 * 
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_self), __pyx_v_match, __pyx_v_seqlen); 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);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.trim_left_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_qual_array);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":900
 *       return None
 * 
 *    cpdef SequenceWithQualities trim_left_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *          Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8trim_left_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8trim_left_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern = 0;
  int __pyx_v_max_mm_qual;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pattern,&__pyx_n_s__max_mm_qual,0};
  __Pyx_RefNannySetupContext("trim_left_end_with_quals");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_mm_qual);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "trim_left_end_with_quals") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)values[0]);
    if (values[1]) {
      __pyx_v_max_mm_qual = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_max_mm_qual == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_max_mm_qual = ((int)5);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trim_left_end_with_quals", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.trim_left_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_5HTSeq_6_HTSeq_Sequence, 1, "pattern", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.max_mm_qual = __pyx_v_max_mm_qual;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->trim_left_end_with_quals(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self), __pyx_v_pattern, 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __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("HTSeq._HTSeq.SequenceWithQualities.trim_left_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":928
 *       return self[ match : seqlen ]
 * 
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *           Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_9trim_right_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_self, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals *__pyx_optional_args) {
  int __pyx_v_max_mm_qual = ((int)5);
  int __pyx_v_seqlen;
  int __pyx_v_patlen;
  int __pyx_v_minlen;
  char *__pyx_v_seq_cstr;
  char *__pyx_v_pat_cstr;
  int __pyx_v_match;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_sum_mm_qual;
  PyArrayObject *__pyx_v_qual_array = 0;
  Py_buffer __pyx_bstruct_qual_array;
  Py_ssize_t __pyx_bstride_0_qual_array = 0;
  Py_ssize_t __pyx_bshape_0_qual_array = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  PyArrayObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  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("trim_right_end_with_quals");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_max_mm_qual = __pyx_optional_args->max_mm_qual;
    }
  }
  __pyx_bstruct_qual_array.buf = NULL;
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_76); 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);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_9trim_right_end_with_quals)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyInt_FromLong(__pyx_v_max_mm_qual); 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 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_v_pattern));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pattern));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pattern));
      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 = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__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;
  }

  /* "HTSeq/_HTSeq.pyx":930
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,
 *           Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )             # <<<<<<<<<<<<<<
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_seqlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":931
 *           Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 *       cdef int patlen = len( pattern.seq )             # <<<<<<<<<<<<<<
 *       cdef int minlen
 *       if seqlen < patlen:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_pattern->seq);
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = PyBytes_GET_SIZE(__pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_patlen = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":933
 *       cdef int patlen = len( pattern.seq )
 *       cdef int minlen
 *       if seqlen < patlen:             # <<<<<<<<<<<<<<
 *          minlen = seqlen
 *       else:
 */
  __pyx_t_5 = (__pyx_v_seqlen < __pyx_v_patlen);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":934
 *       cdef int minlen
 *       if seqlen < patlen:
 *          minlen = seqlen             # <<<<<<<<<<<<<<
 *       else:
 *          minlen = patlen
 */
    __pyx_v_minlen = __pyx_v_seqlen;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":936
 *          minlen = seqlen
 *       else:
 *          minlen = patlen             # <<<<<<<<<<<<<<
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 */
    __pyx_v_minlen = __pyx_v_patlen;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":937
 *       else:
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq             # <<<<<<<<<<<<<<
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->__pyx_base.seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_seq_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":938
 *          minlen = patlen
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq             # <<<<<<<<<<<<<<
 *       cdef int match = 0
 *       cdef int i, j
 */
  __pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_pattern->seq)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pat_cstr = __pyx_t_6;

  /* "HTSeq/_HTSeq.pyx":939
 *       cdef char * seq_cstr = self.seq
 *       cdef char * pat_cstr = pattern.seq
 *       cdef int match = 0             # <<<<<<<<<<<<<<
 *       cdef int i, j
 *       cdef int sum_mm_qual
 */
  __pyx_v_match = 0;

  /* "HTSeq/_HTSeq.pyx":942
 *       cdef int i, j
 *       cdef int sum_mm_qual
 *       if self._qualarr is None:             # <<<<<<<<<<<<<<
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 */
  __pyx_t_5 = (__pyx_v_self->_qualarr == Py_None);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":943
 *       cdef int sum_mm_qual
 *       if self._qualarr is None:
 *          self._fill_qual_arr()             # <<<<<<<<<<<<<<
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self->__pyx_base.__pyx_vtab)->_fill_qual_arr(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "HTSeq/_HTSeq.pyx":944
 *       if self._qualarr is None:
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr             # <<<<<<<<<<<<<<
 *       for i in xrange( 1, minlen+1 ):
 *          sum_mm_qual = 0
 */
  if (!(likely(((__pyx_v_self->_qualarr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->_qualarr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->_qualarr);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_qual_array, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_qual_array = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_qual_array.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_bstride_0_qual_array = __pyx_bstruct_qual_array.strides[0];
      __pyx_bshape_0_qual_array = __pyx_bstruct_qual_array.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __Pyx_INCREF(__pyx_v_self->_qualarr);
  __pyx_v_qual_array = ((PyArrayObject *)__pyx_v_self->_qualarr);

  /* "HTSeq/_HTSeq.pyx":945
 *          self._fill_qual_arr()
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):             # <<<<<<<<<<<<<<
 *          sum_mm_qual = 0
 *          for j in xrange( i ):
 */
  __pyx_t_8 = (__pyx_v_minlen + 1);
  for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "HTSeq/_HTSeq.pyx":946
 *       cdef numpy.ndarray[ numpy.int_t, ndim=1 ] qual_array = self._qualarr
 *       for i in xrange( 1, minlen+1 ):
 *          sum_mm_qual = 0             # <<<<<<<<<<<<<<
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 */
    __pyx_v_sum_mm_qual = 0;

    /* "HTSeq/_HTSeq.pyx":947
 *       for i in xrange( 1, minlen+1 ):
 *          sum_mm_qual = 0
 *          for j in xrange( i ):             # <<<<<<<<<<<<<<
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                sum_mm_qual += qual_array[ seqlen - i + j ]
 */
    __pyx_t_10 = __pyx_v_i;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_j = __pyx_t_11;

      /* "HTSeq/_HTSeq.pyx":948
 *          sum_mm_qual = 0
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:             # <<<<<<<<<<<<<<
 *                sum_mm_qual += qual_array[ seqlen - i + j ]
 *                if sum_mm_qual > max_mm_qual:
 */
      __pyx_t_5 = ((__pyx_v_seq_cstr[((__pyx_v_seqlen - __pyx_v_i) + __pyx_v_j)]) != (__pyx_v_pat_cstr[__pyx_v_j]));
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":949
 *          for j in xrange( i ):
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                sum_mm_qual += qual_array[ seqlen - i + j ]             # <<<<<<<<<<<<<<
 *                if sum_mm_qual > max_mm_qual:
 *                   break
 */
        __pyx_t_12 = ((__pyx_v_seqlen - __pyx_v_i) + __pyx_v_j);
        __pyx_t_13 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_qual_array;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_13 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_qual_array)) __pyx_t_13 = 0;
        if (unlikely(__pyx_t_13 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_13);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_sum_mm_qual = (__pyx_v_sum_mm_qual + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_qual_array.buf, __pyx_t_12, __pyx_bstride_0_qual_array)));

        /* "HTSeq/_HTSeq.pyx":950
 *             if seq_cstr[ seqlen - i + j ] != pat_cstr[ j ]:
 *                sum_mm_qual += qual_array[ seqlen - i + j ]
 *                if sum_mm_qual > max_mm_qual:             # <<<<<<<<<<<<<<
 *                   break
 *          else:
 */
        __pyx_t_5 = (__pyx_v_sum_mm_qual > __pyx_v_max_mm_qual);
        if (__pyx_t_5) {

          /* "HTSeq/_HTSeq.pyx":951
 *                sum_mm_qual += qual_array[ seqlen - i + j ]
 *                if sum_mm_qual > max_mm_qual:
 *                   break             # <<<<<<<<<<<<<<
 *          else:
 *             match = i
 */
          goto __pyx_L8_break;
          goto __pyx_L10;
        }
        __pyx_L10:;
        goto __pyx_L9;
      }
      __pyx_L9:;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":953
 *                   break
 *          else:
 *             match = i             # <<<<<<<<<<<<<<
 *       return self[ 0 : seqlen-match ]
 * 
 */
      __pyx_v_match = __pyx_v_i;
    }
    __pyx_L8_break:;
  }

  /* "HTSeq/_HTSeq.pyx":954
 *          else:
 *             match = i
 *       return self[ 0 : seqlen-match ]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_self), 0, (__pyx_v_seqlen - __pyx_v_match)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)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);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.trim_right_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_qual_array);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_qual_array);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":928
 *       return self[ match : seqlen ]
 * 
 *    cpdef SequenceWithQualities trim_right_end_with_quals( SequenceWithQualities self,             # <<<<<<<<<<<<<<
 *           Sequence pattern, int max_mm_qual = 5 ):
 *       cdef int seqlen = len( self.seq )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_9trim_right_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_9trim_right_end_with_quals(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *__pyx_v_pattern = 0;
  int __pyx_v_max_mm_qual;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pattern,&__pyx_n_s__max_mm_qual,0};
  __Pyx_RefNannySetupContext("trim_right_end_with_quals");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_mm_qual);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "trim_right_end_with_quals") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pattern = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)values[0]);
    if (values[1]) {
      __pyx_v_max_mm_qual = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_max_mm_qual == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_max_mm_qual = ((int)5);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("trim_right_end_with_quals", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SequenceWithQualities.trim_right_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pattern), __pyx_ptype_5HTSeq_6_HTSeq_Sequence, 1, "pattern", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.max_mm_qual = __pyx_v_max_mm_qual;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->__pyx_base.__pyx_vtab)->trim_right_end_with_quals(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self), __pyx_v_pattern, 1, &__pyx_t_2)); 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_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("HTSeq._HTSeq.SequenceWithQualities.trim_right_end_with_quals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":30
 * 
 * cdef class SequenceWithQualities( Sequence ):
 *    cdef readonly bytes _qualstr             # <<<<<<<<<<<<<<
 *    cdef readonly bytes _qualstr_phred
 *    cdef readonly str _qualscale
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualstr___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualstr___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pxd":31
 * cdef class SequenceWithQualities( Sequence ):
 *    cdef readonly bytes _qualstr
 *    cdef readonly bytes _qualstr_phred             # <<<<<<<<<<<<<<
 *    cdef readonly str _qualscale
 *    cdef readonly object _qualarr
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_14_qualstr_phred___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_14_qualstr_phred___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualstr_phred);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pxd":32
 *    cdef readonly bytes _qualstr
 *    cdef readonly bytes _qualstr_phred
 *    cdef readonly str _qualscale             # <<<<<<<<<<<<<<
 *    cdef readonly object _qualarr
 *    cdef _fill_qual_arr( SequenceWithQualities self )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_10_qualscale___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_10_qualscale___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualscale);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pxd":33
 *    cdef readonly bytes _qualstr_phred
 *    cdef readonly str _qualscale
 *    cdef readonly object _qualarr             # <<<<<<<<<<<<<<
 *    cdef _fill_qual_arr( SequenceWithQualities self )
 *    cpdef object add_qual_to_count_array( SequenceWithQualities self, numpy.ndarray count_array_ )
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualarr___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualarr___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr);
  __pyx_r = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_self)->_qualarr;
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":972
 *    """
 * 
 *    def __init__( self, read, iv ):             # <<<<<<<<<<<<<<
 *       self._read = read
 *       self.iv = iv
 */

static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_iv = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__read,&__pyx_n_s__iv,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iv);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_read = values[0];
    __pyx_v_iv = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":973
 * 
 *    def __init__( self, read, iv ):
 *       self._read = read             # <<<<<<<<<<<<<<
 *       self.iv = iv
 * 
 */
  if (!(likely(((__pyx_v_read) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_read, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_read);
  __Pyx_GIVEREF(__pyx_v_read);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_read);

  /* "HTSeq/_HTSeq.pyx":974
 *    def __init__( self, read, iv ):
 *       self._read = read
 *       self.iv = iv             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
  if (!(likely(((__pyx_v_iv) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_iv, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_iv);
  __Pyx_GIVEREF(__pyx_v_iv);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_iv);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":977
 * 
 *    @property
 *    def read( self ):             # <<<<<<<<<<<<<<
 *       return self._read
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_1read(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read");

  /* "HTSeq/_HTSeq.pyx":978
 *    @property
 *    def read( self ):
 *       return self._read             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pyx":980
 *       return self._read
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       cdef str s
 *       if self.paired_end:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_2__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_2__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = NULL;
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "HTSeq/_HTSeq.pyx":982
 *    def __repr__( self ):
 *       cdef str s
 *       if self.paired_end:             # <<<<<<<<<<<<<<
 *          s = "Paired-end read"
 *       else:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__paired_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":983
 *       cdef str s
 *       if self.paired_end:
 *          s = "Paired-end read"             # <<<<<<<<<<<<<<
 *       else:
 *          s = "Read"
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_77));
    __pyx_v_s = __pyx_kp_s_77;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":985
 *          s = "Paired-end read"
 *       else:
 *          s = "Read"             # <<<<<<<<<<<<<<
 *       if self.aligned:
 *          return "<%s object: %s '%s' aligned to %s>" % (
 */
    __Pyx_INCREF(((PyObject *)__pyx_n_s__Read));
    __pyx_v_s = __pyx_n_s__Read;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":986
 *       else:
 *          s = "Read"
 *       if self.aligned:             # <<<<<<<<<<<<<<
 *          return "<%s object: %s '%s' aligned to %s>" % (
 *             self.__class__.__name__, s, self.read.name, str(self.iv) )
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__aligned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":987
 *          s = "Read"
 *       if self.aligned:
 *          return "<%s object: %s '%s' aligned to %s>" % (             # <<<<<<<<<<<<<<
 *             self.__class__.__name__, s, self.read.name, str(self.iv) )
 *       else:
 */
    __Pyx_XDECREF(__pyx_r);

    /* "HTSeq/_HTSeq.pyx":988
 *       if self.aligned:
 *          return "<%s object: %s '%s' aligned to %s>" % (
 *             self.__class__.__name__, s, self.read.name, str(self.iv) )             # <<<<<<<<<<<<<<
 *       else:
 *          return "<%s object: %s '%s', not aligned>" % (
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); 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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); 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_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); 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_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __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 = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_s));
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_s));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_s));
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":990
 *             self.__class__.__name__, s, self.read.name, str(self.iv) )
 *       else:
 *          return "<%s object: %s '%s', not aligned>" % (             # <<<<<<<<<<<<<<
 *             self.__class__.__name__, s, self.read.name )
 * 
 */
    __Pyx_XDECREF(__pyx_r);

    /* "HTSeq/_HTSeq.pyx":991
 *       else:
 *          return "<%s object: %s '%s', not aligned>" % (
 *             self.__class__.__name__, s, self.read.name )             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_s));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_s));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_s));
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_79), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_r = ((PyObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":994
 * 
 *    @property
 *    def paired_end( self ):             # <<<<<<<<<<<<<<
 *       return False
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_3paired_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_3paired_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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("paired_end");

  /* "HTSeq/_HTSeq.pyx":995
 *    @property
 *    def paired_end( self ):
 *       return False             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __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("HTSeq._HTSeq.Alignment.paired_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":998
 * 
 *    @property
 *    def aligned( self ):             # <<<<<<<<<<<<<<
 *       """Returns True unless self.iv is None. The latter indicates that
 *       this record decribes a read for which no alignment was found.
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_4aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5HTSeq_6_HTSeq_9Alignment_4aligned[] = "Returns True unless self.iv is None. The latter indicates that\n      this record decribes a read for which no alignment was found.\n      ";
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_4aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("aligned");

  /* "HTSeq/_HTSeq.pyx":1002
 *       this record decribes a read for which no alignment was found.
 *       """
 *       return self.iv is not None             # <<<<<<<<<<<<<<
 * 
 * cdef class AlignmentWithSequenceReversal( Alignment ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv) != Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment.aligned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":43
 * 
 * cdef class Alignment( object ):
 *    cdef public SequenceWithQualities _read             # <<<<<<<<<<<<<<
 *    cdef public GenomicInterval iv
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment._read.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->_read = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":44
 * cdef class Alignment( object ):
 *    cdef public SequenceWithQualities _read
 *    cdef public GenomicInterval iv             # <<<<<<<<<<<<<<
 * 
 * cdef class AlignmentWithSequenceReversal( Alignment ):
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.Alignment.iv.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)__pyx_v_self)->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1015
 *    """
 * 
 *    def __init__( self, SequenceWithQualities read_as_aligned, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       self.read_as_aligned = read_as_aligned
 *       self._read_as_sequenced = None
 */

static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_read_as_aligned = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_iv = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__read_as_aligned,&__pyx_n_s__iv,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read_as_aligned);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iv);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_read_as_aligned = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)values[0]);
    __pyx_v_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.AlignmentWithSequenceReversal.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read_as_aligned), __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities, 1, "read_as_aligned", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iv), __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval, 1, "iv", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":1016
 * 
 *    def __init__( self, SequenceWithQualities read_as_aligned, GenomicInterval iv ):
 *       self.read_as_aligned = read_as_aligned             # <<<<<<<<<<<<<<
 *       self._read_as_sequenced = None
 *       self.iv = iv
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_read_as_aligned));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_read_as_aligned));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned = __pyx_v_read_as_aligned;

  /* "HTSeq/_HTSeq.pyx":1017
 *    def __init__( self, SequenceWithQualities read_as_aligned, GenomicInterval iv ):
 *       self.read_as_aligned = read_as_aligned
 *       self._read_as_sequenced = None             # <<<<<<<<<<<<<<
 *       self.iv = iv
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None);

  /* "HTSeq/_HTSeq.pyx":1018
 *       self.read_as_aligned = read_as_aligned
 *       self._read_as_sequenced = None
 *       self.iv = iv             # <<<<<<<<<<<<<<
 * 
 *    property read:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_iv));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_iv));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->__pyx_base.iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->__pyx_base.iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->__pyx_base.iv = __pyx_v_iv;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.AlignmentWithSequenceReversal.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1021
 * 
 *    property read:
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          if self._read_as_sequenced is None:
 *             if (not self.aligned) or self.iv.strand != "-":
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_4read___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_4read___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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("__get__");

  /* "HTSeq/_HTSeq.pyx":1022
 *    property read:
 *       def __get__( self ):
 *          if self._read_as_sequenced is None:             # <<<<<<<<<<<<<<
 *             if (not self.aligned) or self.iv.strand != "-":
 *                self._read_as_sequenced = self.read_as_aligned
 */
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced) == Py_None);
  if (__pyx_t_1) {

    /* "HTSeq/_HTSeq.pyx":1023
 *       def __get__( self ):
 *          if self._read_as_sequenced is None:
 *             if (not self.aligned) or self.iv.strand != "-":             # <<<<<<<<<<<<<<
 *                self._read_as_sequenced = self.read_as_aligned
 *             else:
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = (!__pyx_t_1);
    if (!__pyx_t_3) {
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->__pyx_base.iv), __pyx_n_s__strand); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_kp_s_38), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_4 = __pyx_t_3;
    }
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1024
 *          if self._read_as_sequenced is None:
 *             if (not self.aligned) or self.iv.strand != "-":
 *                self._read_as_sequenced = self.read_as_aligned             # <<<<<<<<<<<<<<
 *             else:
 *                self._read_as_sequenced = self.read_as_aligned.get_reverse_complement()
 */
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
      __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
      ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned;
      goto __pyx_L6;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1026
 *                self._read_as_sequenced = self.read_as_aligned
 *             else:
 *                self._read_as_sequenced = self.read_as_aligned.get_reverse_complement()             # <<<<<<<<<<<<<<
 *                self._read_as_sequenced.name = self.read_as_aligned.name
 *          return self._read_as_sequenced
 */
      __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5HTSeq_6_HTSeq_SequenceWithQualities *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned->__pyx_base.__pyx_vtab)->get_reverse_complement(((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
      ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "HTSeq/_HTSeq.pyx":1027
 *             else:
 *                self._read_as_sequenced = self.read_as_aligned.get_reverse_complement()
 *                self._read_as_sequenced.name = self.read_as_aligned.name             # <<<<<<<<<<<<<<
 *          return self._read_as_sequenced
 *       #def __set__( self, read ):
 */
      __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned->__pyx_base.name));
      __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned->__pyx_base.name));
      __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced->__pyx_base.name);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced->__pyx_base.name));
      ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced->__pyx_base.name = ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned->__pyx_base.name;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":1028
 *                self._read_as_sequenced = self.read_as_aligned.get_reverse_complement()
 *                self._read_as_sequenced.name = self.read_as_aligned.name
 *          return self._read_as_sequenced             # <<<<<<<<<<<<<<
 *       #def __set__( self, read ):
 *       #   self.read_as_aligned = read
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.AlignmentWithSequenceReversal.read.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":47
 * 
 * cdef class AlignmentWithSequenceReversal( Alignment ):
 *    cdef public SequenceWithQualities read_as_aligned             # <<<<<<<<<<<<<<
 *    cdef public SequenceWithQualities _read_as_sequenced
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.AlignmentWithSequenceReversal.read_as_aligned.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->read_as_aligned = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":48
 * cdef class AlignmentWithSequenceReversal( Alignment ):
 *    cdef public SequenceWithQualities read_as_aligned
 *    cdef public SequenceWithQualities _read_as_sequenced             # <<<<<<<<<<<<<<
 * 
 * cdef class SAM_Alignment( AlignmentWithSequenceReversal ):
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.AlignmentWithSequenceReversal._read_as_sequenced.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)__pyx_v_self)->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1047
 *    cdef public str substitutions
 * 
 *    def __init__( self, bowtie_line ):             # <<<<<<<<<<<<<<
 *       cdef str readId, strand, chrom, position, read, qual
 *       cdef int positionint
 */

static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bowtie_line = 0;
  PyObject *__pyx_v_readId = 0;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_position = 0;
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_qual = 0;
  int __pyx_v_positionint;
  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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__bowtie_line,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bowtie_line);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __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_bowtie_line = 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 = 1047; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.BowtieAlignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":1051
 *       cdef int positionint
 *       (readId, strand, chrom, position, read, qual,
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )             # <<<<<<<<<<<<<<
 *       positionint = int( position )
 *       AlignmentWithSequenceReversal.__init__( self,
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_bowtie_line, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __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))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 8)) {
        if (PyTuple_GET_SIZE(sequence) > 8) __Pyx_RaiseTooManyValuesError(8);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_t_5 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 7); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 8)) {
        if (PyList_GET_SIZE(sequence) > 8) __Pyx_RaiseTooManyValuesError(8);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 7); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } 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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 3; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 4; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 5; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 6; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 7; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_9);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }

  /* "HTSeq/_HTSeq.pyx":1050
 *       cdef str readId, strand, chrom, position, read, qual
 *       cdef int positionint
 *       (readId, strand, chrom, position, read, qual,             # <<<<<<<<<<<<<<
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )
 *       positionint = int( position )
 */
  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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_8)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_9)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_readId = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_strand = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_chrom = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_position = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_read = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v_qual = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "HTSeq/_HTSeq.pyx":1051
 *       cdef int positionint
 *       (readId, strand, chrom, position, read, qual,
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )             # <<<<<<<<<<<<<<
 *       positionint = int( position )
 *       AlignmentWithSequenceReversal.__init__( self,
 */
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_9);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "HTSeq/_HTSeq.pyx":1052
 *       (readId, strand, chrom, position, read, qual,
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )
 *       positionint = int( position )             # <<<<<<<<<<<<<<
 *       AlignmentWithSequenceReversal.__init__( self,
 *          SequenceWithQualities( read, readId, qual ),
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_position));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_position));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_position));
  __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_positionint = __pyx_t_12;

  /* "HTSeq/_HTSeq.pyx":1053
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )
 *       positionint = int( position )
 *       AlignmentWithSequenceReversal.__init__( self,             # <<<<<<<<<<<<<<
 *          SequenceWithQualities( read, readId, qual ),
 *          GenomicInterval( chrom, positionint, positionint + len(read), strand ) )
 */
  __pyx_t_9 = PyObject_GetAttr(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal)), __pyx_n_s____init__); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "HTSeq/_HTSeq.pyx":1054
 *       positionint = int( position )
 *       AlignmentWithSequenceReversal.__init__( self,
 *          SequenceWithQualities( read, readId, qual ),             # <<<<<<<<<<<<<<
 *          GenomicInterval( chrom, positionint, positionint + len(read), strand ) )
 * 
 */
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_read));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_read));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_read));
  __Pyx_INCREF(((PyObject *)__pyx_v_readId));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_readId));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_readId));
  __Pyx_INCREF(((PyObject *)__pyx_v_qual));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_qual));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_qual));
  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1055
 *       AlignmentWithSequenceReversal.__init__( self,
 *          SequenceWithQualities( read, readId, qual ),
 *          GenomicInterval( chrom, positionint, positionint + len(read), strand ) )             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_v_positionint); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_read)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = PyInt_FromSsize_t((__pyx_v_positionint + __pyx_t_13)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_strand));
  PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_strand));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
  __pyx_t_2 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_8 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("HTSeq._HTSeq.BowtieAlignment.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_readId);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_position);
  __Pyx_XDECREF(__pyx_v_read);
  __Pyx_XDECREF(__pyx_v_qual);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1044
 *    """
 * 
 *    cdef public str reserved             # <<<<<<<<<<<<<<
 *    cdef public str substitutions
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.BowtieAlignment.reserved.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->reserved = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1045
 * 
 *    cdef public str reserved
 *    cdef public str substitutions             # <<<<<<<<<<<<<<
 * 
 *    def __init__( self, bowtie_line ):
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.BowtieAlignment.substitutions.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)__pyx_v_self)->substitutions = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1074
 *    cdef public int query_from, query_to
 * 
 *    def __init__( self, str type_, int size, int rfrom, int rto, int qfrom,             # <<<<<<<<<<<<<<
 *          int qto, str chrom, str strand, bint check=True ):
 *       self.type = type_
 */

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_type_ = 0;
  int __pyx_v_size;
  int __pyx_v_rfrom;
  int __pyx_v_rto;
  int __pyx_v_qfrom;
  int __pyx_v_qto;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_strand = 0;
  int __pyx_v_check;
  int __pyx_r;
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__type_,&__pyx_n_s__size,&__pyx_n_s__rfrom,&__pyx_n_s__rto,&__pyx_n_s__qfrom,&__pyx_n_s__qto,&__pyx_n_s__chrom,&__pyx_n_s__strand,&__pyx_n_s__check,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__type_);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rfrom);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rto);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__qfrom);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__qto);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
        if (likely(values[6])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
        if (likely(values[7])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__check);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_type_ = ((PyObject*)values[0]);
    __pyx_v_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_rfrom = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_rfrom == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_rto = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_rto == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_qfrom = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_qfrom == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_qto = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_qto == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_chrom = ((PyObject*)values[6]);
    __pyx_v_strand = ((PyObject*)values[7]);
    if (values[8]) {
      __pyx_v_check = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_check == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "HTSeq/_HTSeq.pyx":1075
 * 
 *    def __init__( self, str type_, int size, int rfrom, int rto, int qfrom,
 *          int qto, str chrom, str strand, bint check=True ):             # <<<<<<<<<<<<<<
 *       self.type = type_
 *       self.size = size
 */
      __pyx_v_check = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_type_), (&PyString_Type), 1, "type_", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":1076
 *    def __init__( self, str type_, int size, int rfrom, int rto, int qfrom,
 *          int qto, str chrom, str strand, bint check=True ):
 *       self.type = type_             # <<<<<<<<<<<<<<
 *       self.size = size
 *       self.ref_iv = GenomicInterval( chrom, rfrom, rto, strand )
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_type_));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_type_));
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type = __pyx_v_type_;

  /* "HTSeq/_HTSeq.pyx":1077
 *          int qto, str chrom, str strand, bint check=True ):
 *       self.type = type_
 *       self.size = size             # <<<<<<<<<<<<<<
 *       self.ref_iv = GenomicInterval( chrom, rfrom, rto, strand )
 *       self.query_from = qfrom
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size = __pyx_v_size;

  /* "HTSeq/_HTSeq.pyx":1078
 *       self.type = type_
 *       self.size = size
 *       self.ref_iv = GenomicInterval( chrom, rfrom, rto, strand )             # <<<<<<<<<<<<<<
 *       self.query_from = qfrom
 *       self.query_to = qto
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_rfrom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_rto); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  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_INCREF(((PyObject *)__pyx_v_strand));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_strand));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1079
 *       self.size = size
 *       self.ref_iv = GenomicInterval( chrom, rfrom, rto, strand )
 *       self.query_from = qfrom             # <<<<<<<<<<<<<<
 *       self.query_to = qto
 *       if check and not self.check():
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_from = __pyx_v_qfrom;

  /* "HTSeq/_HTSeq.pyx":1080
 *       self.ref_iv = GenomicInterval( chrom, rfrom, rto, strand )
 *       self.query_from = qfrom
 *       self.query_to = qto             # <<<<<<<<<<<<<<
 *       if check and not self.check():
 *          raise ValueError, "Inconsistent CIGAR operation."
 */
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_to = __pyx_v_qto;

  /* "HTSeq/_HTSeq.pyx":1081
 *       self.query_from = qfrom
 *       self.query_to = qto
 *       if check and not self.check():             # <<<<<<<<<<<<<<
 *          raise ValueError, "Inconsistent CIGAR operation."
 * 
 */
  if (__pyx_v_check) {
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__check); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __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 = 1081; __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_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = (!__pyx_t_4);
    __pyx_t_4 = __pyx_t_5;
  } else {
    __pyx_t_4 = __pyx_v_check;
  }
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1082
 *       self.query_to = qto
 *       if check and not self.check():
 *          raise ValueError, "Inconsistent CIGAR operation."             # <<<<<<<<<<<<<<
 * 
 *    def __repr__( self ):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_82), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1084
 *          raise ValueError, "Inconsistent CIGAR operation."
 * 
 *    def __repr__( self ):             # <<<<<<<<<<<<<<
 *       return "< %s: %d base(s) %s on ref iv %s, query iv [%d,%d) >" % (
 *          self.__class__.__name__, self.size, cigar_operation_names[ self.type ],
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_1__repr__(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;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "HTSeq/_HTSeq.pyx":1085
 * 
 *    def __repr__( self ):
 *       return "< %s: %d base(s) %s on ref iv %s, query iv [%d,%d) >" % (             # <<<<<<<<<<<<<<
 *          self.__class__.__name__, self.size, cigar_operation_names[ self.type ],
 *          str( self.ref_iv ), self.query_from, self.query_to )
 */
  __Pyx_XDECREF(__pyx_r);

  /* "HTSeq/_HTSeq.pyx":1086
 *    def __repr__( self ):
 *       return "< %s: %d base(s) %s on ref iv %s, query iv [%d,%d) >" % (
 *          self.__class__.__name__, self.size, cigar_operation_names[ self.type ],             # <<<<<<<<<<<<<<
 *          str( self.ref_iv ), self.query_from, self.query_to )
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_84); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetItem(__pyx_t_3, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":1087
 *       return "< %s: %d base(s) %s on ref iv %s, query iv [%d,%d) >" % (
 *          self.__class__.__name__, self.size, cigar_operation_names[ self.type ],
 *          str( self.ref_iv ), self.query_from, self.query_to )             # <<<<<<<<<<<<<<
 * 
 *    def check( CigarOperation self ):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_from); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_to); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_83), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1089
 *          str( self.ref_iv ), self.query_from, self.query_to )
 * 
 *    def check( CigarOperation self ):             # <<<<<<<<<<<<<<
 *       cdef int qlen = self.query_to - self.query_from
 *       cdef int rlen = self.ref_iv.length
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_2check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_2check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  int __pyx_v_qlen;
  int __pyx_v_rlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check");

  /* "HTSeq/_HTSeq.pyx":1090
 * 
 *    def check( CigarOperation self ):
 *       cdef int qlen = self.query_to - self.query_from             # <<<<<<<<<<<<<<
 *       cdef int rlen = self.ref_iv.length
 *       if self.type == 'M':
 */
  __pyx_v_qlen = (((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_to - ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_from);

  /* "HTSeq/_HTSeq.pyx":1091
 *    def check( CigarOperation self ):
 *       cdef int qlen = self.query_to - self.query_from
 *       cdef int rlen = self.ref_iv.length             # <<<<<<<<<<<<<<
 *       if self.type == 'M':
 *          if not ( qlen == self.size and rlen == self.size ):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv), __pyx_n_s__length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rlen = __pyx_t_2;

  /* "HTSeq/_HTSeq.pyx":1092
 *       cdef int qlen = self.query_to - self.query_from
 *       cdef int rlen = self.ref_iv.length
 *       if self.type == 'M':             # <<<<<<<<<<<<<<
 *          if not ( qlen == self.size and rlen == self.size ):
 *             return False
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__M), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":1093
 *       cdef int rlen = self.ref_iv.length
 *       if self.type == 'M':
 *          if not ( qlen == self.size and rlen == self.size ):             # <<<<<<<<<<<<<<
 *             return False
 *       elif self.type == 'I' or self.type == 'S':
 */
    __pyx_t_3 = (__pyx_v_qlen == ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size);
    if (__pyx_t_3) {
      __pyx_t_4 = (__pyx_v_rlen == ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = (!__pyx_t_5);
    if (__pyx_t_3) {

      /* "HTSeq/_HTSeq.pyx":1094
 *       if self.type == 'M':
 *          if not ( qlen == self.size and rlen == self.size ):
 *             return False             # <<<<<<<<<<<<<<
 *       elif self.type == 'I' or self.type == 'S':
 *          if not ( qlen == self.size and rlen == 0 ):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __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_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":1095
 *          if not ( qlen == self.size and rlen == self.size ):
 *             return False
 *       elif self.type == 'I' or self.type == 'S':             # <<<<<<<<<<<<<<
 *          if not ( qlen == self.size and rlen == 0 ):
 *             return False
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_5;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1096
 *             return False
 *       elif self.type == 'I' or self.type == 'S':
 *          if not ( qlen == self.size and rlen == 0 ):             # <<<<<<<<<<<<<<
 *             return False
 *       elif self.type == 'D' or self.type == 'N':
 */
    __pyx_t_4 = (__pyx_v_qlen == ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size);
    if (__pyx_t_4) {
      __pyx_t_3 = (__pyx_v_rlen == 0);
      __pyx_t_5 = __pyx_t_3;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    __pyx_t_4 = (!__pyx_t_5);
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1097
 *       elif self.type == 'I' or self.type == 'S':
 *          if not ( qlen == self.size and rlen == 0 ):
 *             return False             # <<<<<<<<<<<<<<
 *       elif self.type == 'D' or self.type == 'N':
 *          if not ( qlen == 0 and rlen == self.size ):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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_L7;
    }
    __pyx_L7:;
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":1098
 *          if not ( qlen == self.size and rlen == 0 ):
 *             return False
 *       elif self.type == 'D' or self.type == 'N':             # <<<<<<<<<<<<<<
 *          if not ( qlen == 0 and rlen == self.size ):
 *             return False
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_4) {
    __pyx_t_5 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__N), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "HTSeq/_HTSeq.pyx":1099
 *             return False
 *       elif self.type == 'D' or self.type == 'N':
 *          if not ( qlen == 0 and rlen == self.size ):             # <<<<<<<<<<<<<<
 *             return False
 *       elif self.type == 'H' or self.type == 'P':
 */
    __pyx_t_3 = (__pyx_v_qlen == 0);
    if (__pyx_t_3) {
      __pyx_t_4 = (__pyx_v_rlen == ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = (!__pyx_t_5);
    if (__pyx_t_3) {

      /* "HTSeq/_HTSeq.pyx":1100
 *       elif self.type == 'D' or self.type == 'N':
 *          if not ( qlen == 0 and rlen == self.size ):
 *             return False             # <<<<<<<<<<<<<<
 *       elif self.type == 'H' or self.type == 'P':
 *          if not ( qlen == 0 and rlen == 0 ):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __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_L8;
    }
    __pyx_L8:;
    goto __pyx_L5;
  }

  /* "HTSeq/_HTSeq.pyx":1101
 *          if not ( qlen == 0 and rlen == self.size ):
 *             return False
 *       elif self.type == 'H' or self.type == 'P':             # <<<<<<<<<<<<<<
 *          if not ( qlen == 0 and rlen == 0 ):
 *             return False
 */
  __pyx_t_3 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__H), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type), ((PyObject *)__pyx_n_s__P), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_5;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1102
 *             return False
 *       elif self.type == 'H' or self.type == 'P':
 *          if not ( qlen == 0 and rlen == 0 ):             # <<<<<<<<<<<<<<
 *             return False
 *       else:
 */
    __pyx_t_4 = (__pyx_v_qlen == 0);
    if (__pyx_t_4) {
      __pyx_t_3 = (__pyx_v_rlen == 0);
      __pyx_t_5 = __pyx_t_3;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    __pyx_t_4 = (!__pyx_t_5);
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1103
 *       elif self.type == 'H' or self.type == 'P':
 *          if not ( qlen == 0 and rlen == 0 ):
 *             return False             # <<<<<<<<<<<<<<
 *       else:
 *          return False
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; __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_L9;
    }
    __pyx_L9:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1105
 *             return False
 *       else:
 *          return False             # <<<<<<<<<<<<<<
 *       return True
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __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_L5:;

  /* "HTSeq/_HTSeq.pyx":1106
 *       else:
 *          return False
 *       return True             # <<<<<<<<<<<<<<
 * 
 * _re_cigar_codes = re.compile( '([A-Z])' )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __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("HTSeq._HTSeq.CigarOperation.check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1069
 * cdef class CigarOperation( object ):
 * 
 *    cdef public str type             # <<<<<<<<<<<<<<
 *    cdef public int size
 *    cdef public GenomicInterval ref_iv
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->type = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1070
 * 
 *    cdef public str type
 *    cdef public int size             # <<<<<<<<<<<<<<
 *    cdef public GenomicInterval ref_iv
 *    cdef public int query_from, query_to
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __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("HTSeq._HTSeq.CigarOperation.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size_1__set__(PyObject *__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__");
  __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 = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->size = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1071
 *    cdef public str type
 *    cdef public int size
 *    cdef public GenomicInterval ref_iv             # <<<<<<<<<<<<<<
 *    cdef public int query_from, query_to
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.ref_iv.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->ref_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1072
 *    cdef public int size
 *    cdef public GenomicInterval ref_iv
 *    cdef public int query_from, query_to             # <<<<<<<<<<<<<<
 * 
 *    def __init__( self, str type_, int size, int rfrom, int rto, int qfrom,
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_from); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __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("HTSeq._HTSeq.CigarOperation.query_from.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from_1__set__(PyObject *__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__");
  __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 = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_from = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.query_from.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_to); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __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("HTSeq._HTSeq.CigarOperation.query_to.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to_1__set__(PyObject *__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__");
  __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 = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_v_self)->query_to = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.CigarOperation.query_to.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1110
 * _re_cigar_codes = re.compile( '([A-Z])' )
 * 
 * cpdef list parse_cigar( str cigar_string, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, cl
 *    cdef int size
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_5parse_cigar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_parse_cigar(PyObject *__pyx_v_cigar_string, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar *__pyx_optional_args) {
  int __pyx_v_ref_left = ((int)0);
  PyObject *__pyx_v_chrom = ((PyObject*)__pyx_kp_s_14);
  PyObject *__pyx_v_strand = ((PyObject*)__pyx_kp_s_11);
  PyObject *__pyx_v_split_cigar = 0;
  PyObject *__pyx_v_cl = 0;
  int __pyx_v_size;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_i = 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;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("parse_cigar");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_ref_left = __pyx_optional_args->ref_left;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_chrom = __pyx_optional_args->chrom;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_strand = __pyx_optional_args->strand;
        }
      }
    }
  }

  /* "HTSeq/_HTSeq.pyx":1114
 *    cdef int size
 *    cdef str code
 *    split_cigar = _re_cigar_codes.split( cigar_string )             # <<<<<<<<<<<<<<
 *    if split_cigar[-1] != '' or len(split_cigar) % 2 != 1:
 *       raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___re_cigar_codes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __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 = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_cigar_string));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_cigar_string));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cigar_string));
  __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 = 1114; __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;
  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 = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_split_cigar = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":1115
 *    cdef str code
 *    split_cigar = _re_cigar_codes.split( cigar_string )
 *    if split_cigar[-1] != '' or len(split_cigar) % 2 != 1:             # <<<<<<<<<<<<<<
 *       raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *    cl = []
 */
  __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_split_cigar), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_kp_s_14), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
    if (unlikely(((PyObject *)__pyx_v_split_cigar) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_split_cigar)); 
    __pyx_t_6 = (__Pyx_mod_Py_ssize_t(__pyx_t_5, 2) != 1);
    __pyx_t_7 = __pyx_t_6;
  } else {
    __pyx_t_7 = __pyx_t_4;
  }
  if (__pyx_t_7) {

    /* "HTSeq/_HTSeq.pyx":1116
 *    split_cigar = _re_cigar_codes.split( cigar_string )
 *    if split_cigar[-1] != '' or len(split_cigar) % 2 != 1:
 *       raise ValueError, "Illegal CIGAR string '%s'" % cigar_string             # <<<<<<<<<<<<<<
 *    cl = []
 *    for i in xrange( len(split_cigar) // 2 ):
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_85), ((PyObject *)__pyx_v_cigar_string)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0, 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":1117
 *    if split_cigar[-1] != '' or len(split_cigar) % 2 != 1:
 *       raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *    cl = []             # <<<<<<<<<<<<<<
 *    for i in xrange( len(split_cigar) // 2 ):
 *       try:
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_v_cl = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "HTSeq/_HTSeq.pyx":1118
 *       raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *    cl = []
 *    for i in xrange( len(split_cigar) // 2 ):             # <<<<<<<<<<<<<<
 *       try:
 *          size = int( split_cigar[2*i] )
 */
  if (unlikely(((PyObject *)__pyx_v_split_cigar) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_split_cigar)); 
  __pyx_t_3 = PyInt_FromSsize_t(__Pyx_div_Py_ssize_t(__pyx_t_5, 2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else {
      __pyx_t_3 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "HTSeq/_HTSeq.pyx":1119
 *    cl = []
 *    for i in xrange( len(split_cigar) // 2 ):
 *       try:             # <<<<<<<<<<<<<<
 *          size = int( split_cigar[2*i] )
 *       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:*/ {

        /* "HTSeq/_HTSeq.pyx":1120
 *    for i in xrange( len(split_cigar) // 2 ):
 *       try:
 *          size = int( split_cigar[2*i] )             # <<<<<<<<<<<<<<
 *       except ValueError:
 *          raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 */
        __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_split_cigar), __pyx_t_3); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__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 = 1120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_size = __pyx_t_12;
      }
      __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_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "HTSeq/_HTSeq.pyx":1121
 *       try:
 *          size = int( split_cigar[2*i] )
 *       except ValueError:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *       code  = split_cigar[2*i+1]
 */
      __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_12) {
        __Pyx_AddTraceback("HTSeq._HTSeq.parse_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_13);

        /* "HTSeq/_HTSeq.pyx":1122
 *          size = int( split_cigar[2*i] )
 *       except ValueError:
 *          raise ValueError, "Illegal CIGAR string '%s'" % cigar_string             # <<<<<<<<<<<<<<
 *       code  = split_cigar[2*i+1]
 *       cl.append( ( code, size ) )
 */
        __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_85), ((PyObject *)__pyx_v_cigar_string)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_14));
        __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_14), 0, 0);
        __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L7_exception_handled;
      }
      __pyx_L8_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_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_L13_try_end:;
    }

    /* "HTSeq/_HTSeq.pyx":1123
 *       except ValueError:
 *          raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *       code  = split_cigar[2*i+1]             # <<<<<<<<<<<<<<
 *       cl.append( ( code, size ) )
 *    return build_cigar_list( cl, ref_left, chrom, strand  )
 */
    __pyx_t_13 = PyNumber_Multiply(__pyx_int_2, __pyx_v_i); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = PyNumber_Add(__pyx_t_13, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_split_cigar), __pyx_t_3); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_13)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_code));
    __pyx_v_code = ((PyObject*)__pyx_t_13);
    __pyx_t_13 = 0;

    /* "HTSeq/_HTSeq.pyx":1124
 *          raise ValueError, "Illegal CIGAR string '%s'" % cigar_string
 *       code  = split_cigar[2*i+1]
 *       cl.append( ( code, size ) )             # <<<<<<<<<<<<<<
 *    return build_cigar_list( cl, ref_left, chrom, strand  )
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_cl) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_13 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_code));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_code));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_code));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    __pyx_t_13 = 0;
    __pyx_t_15 = PyList_Append(__pyx_v_cl, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1125
 *       code  = split_cigar[2*i+1]
 *       cl.append( ( code, size ) )
 *    return build_cigar_list( cl, ref_left, chrom, strand  )             # <<<<<<<<<<<<<<
 * 
 * cpdef list build_cigar_list( list cigar_pairs, int ref_left = 0, str chrom = "", str strand = "." ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_16.__pyx_n = 3;
  __pyx_t_16.ref_left = __pyx_v_ref_left;
  __pyx_t_16.chrom = __pyx_v_chrom;
  __pyx_t_16.strand = __pyx_v_strand;
  __pyx_t_1 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_build_cigar_list(__pyx_v_cl, 0, &__pyx_t_16)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __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_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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("HTSeq._HTSeq.parse_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_split_cigar);
  __Pyx_XDECREF(__pyx_v_cl);
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1110
 * _re_cigar_codes = re.compile( '([A-Z])' )
 * 
 * cpdef list parse_cigar( str cigar_string, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, cl
 *    cdef int size
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_5parse_cigar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_5parse_cigar(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cigar_string = 0;
  int __pyx_v_ref_left;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cigar_string,&__pyx_n_s__ref_left,&__pyx_n_s__chrom,&__pyx_n_s__strand,0};
  __Pyx_RefNannySetupContext("parse_cigar");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject*)__pyx_kp_s_14);
    values[3] = ((PyObject*)__pyx_kp_s_11);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cigar_string);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_left);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "parse_cigar") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cigar_string = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_ref_left = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_ref_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ref_left = ((int)0);
    }
    __pyx_v_chrom = ((PyObject*)values[2]);
    __pyx_v_strand = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parse_cigar", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.parse_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cigar_string), (&PyString_Type), 1, "cigar_string", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.ref_left = __pyx_v_ref_left;
  __pyx_t_2.chrom = __pyx_v_chrom;
  __pyx_t_2.strand = __pyx_v_strand;
  __pyx_t_1 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_parse_cigar(__pyx_v_cigar_string, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __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("HTSeq._HTSeq.parse_cigar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1127
 *    return build_cigar_list( cl, ref_left, chrom, strand  )
 * 
 * cpdef list build_cigar_list( list cigar_pairs, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, res
 *    cdef int rpos, qpos, size
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_6build_cigar_list(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5HTSeq_6_HTSeq_build_cigar_list(PyObject *__pyx_v_cigar_pairs, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list *__pyx_optional_args) {
  int __pyx_v_ref_left = ((int)0);
  PyObject *__pyx_v_chrom = ((PyObject*)__pyx_kp_s_14);
  PyObject *__pyx_v_strand = ((PyObject*)__pyx_kp_s_11);
  PyObject *__pyx_v_res = 0;
  int __pyx_v_rpos;
  int __pyx_v_qpos;
  int __pyx_v_size;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_r = NULL;
  __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 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("build_cigar_list");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_ref_left = __pyx_optional_args->ref_left;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_chrom = __pyx_optional_args->chrom;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_strand = __pyx_optional_args->strand;
        }
      }
    }
  }

  /* "HTSeq/_HTSeq.pyx":1131
 *    cdef int rpos, qpos, size
 *    cdef str code
 *    rpos = ref_left             # <<<<<<<<<<<<<<
 *    qpos = 0
 *    res = []
 */
  __pyx_v_rpos = __pyx_v_ref_left;

  /* "HTSeq/_HTSeq.pyx":1132
 *    cdef str code
 *    rpos = ref_left
 *    qpos = 0             # <<<<<<<<<<<<<<
 *    res = []
 *    for code, size in cigar_pairs:
 */
  __pyx_v_qpos = 0;

  /* "HTSeq/_HTSeq.pyx":1133
 *    rpos = ref_left
 *    qpos = 0
 *    res = []             # <<<<<<<<<<<<<<
 *    for code, size in cigar_pairs:
 *       if code == 'M':
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1134
 *    qpos = 0
 *    res = []
 *    for code, size in cigar_pairs:             # <<<<<<<<<<<<<<
 *       if code == 'M':
 *          res.append( CigarOperation (
 */
  if (unlikely(((PyObject *)__pyx_v_cigar_pairs) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_cigar_pairs); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    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 = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_code));
    __pyx_v_code = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_size = __pyx_t_8;

    /* "HTSeq/_HTSeq.pyx":1135
 *    res = []
 *    for code, size in cigar_pairs:
 *       if code == 'M':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'M', size, rpos, rpos + size, qpos, qpos + size, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__M), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1136
 *    for code, size in cigar_pairs:
 *       if code == 'M':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'M', size, rpos, rpos + size, qpos, qpos + size, chrom, strand ) )
 *          rpos += size
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1137
 *       if code == 'M':
 *          res.append( CigarOperation (
 *             'M', size, rpos, rpos + size, qpos, qpos + size, chrom, strand ) )             # <<<<<<<<<<<<<<
 *          rpos += size
 *          qpos += size
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyInt_FromLong((__pyx_v_rpos + __pyx_v_size)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyInt_FromLong((__pyx_v_qpos + __pyx_v_size)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__M));
      PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_n_s__M));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M));
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_11, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_10); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "HTSeq/_HTSeq.pyx":1138
 *          res.append( CigarOperation (
 *             'M', size, rpos, rpos + size, qpos, qpos + size, chrom, strand ) )
 *          rpos += size             # <<<<<<<<<<<<<<
 *          qpos += size
 *       elif code == 'I':
 */
      __pyx_v_rpos = (__pyx_v_rpos + __pyx_v_size);

      /* "HTSeq/_HTSeq.pyx":1139
 *             'M', size, rpos, rpos + size, qpos, qpos + size, chrom, strand ) )
 *          rpos += size
 *          qpos += size             # <<<<<<<<<<<<<<
 *       elif code == 'I':
 *          res.append( CigarOperation (
 */
      __pyx_v_qpos = (__pyx_v_qpos + __pyx_v_size);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1140
 *          rpos += size
 *          qpos += size
 *       elif code == 'I':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'I', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__I), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1141
 *          qpos += size
 *       elif code == 'I':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'I', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1142
 *       elif code == 'I':
 *          res.append( CigarOperation (
 *             'I', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )             # <<<<<<<<<<<<<<
 *          qpos += size
 *       elif code == 'D':
 */
      __pyx_t_10 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong((__pyx_v_qpos + __pyx_v_size)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__I));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_5); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "HTSeq/_HTSeq.pyx":1143
 *          res.append( CigarOperation (
 *             'I', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size             # <<<<<<<<<<<<<<
 *       elif code == 'D':
 *          res.append( CigarOperation (
 */
      __pyx_v_qpos = (__pyx_v_qpos + __pyx_v_size);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1144
 *             'I', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size
 *       elif code == 'D':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'D', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1145
 *          qpos += size
 *       elif code == 'D':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'D', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1146
 *       elif code == 'D':
 *          res.append( CigarOperation (
 *             'D', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )             # <<<<<<<<<<<<<<
 *          rpos += size
 *       elif code == 'N':
 */
      __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyInt_FromLong((__pyx_v_rpos + __pyx_v_size)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_n_s__D));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_10, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_11 = 0;
      __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_11); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "HTSeq/_HTSeq.pyx":1147
 *          res.append( CigarOperation (
 *             'D', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size             # <<<<<<<<<<<<<<
 *       elif code == 'N':
 *          res.append( CigarOperation (
 */
      __pyx_v_rpos = (__pyx_v_rpos + __pyx_v_size);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1148
 *             'D', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size
 *       elif code == 'N':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'N', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__N), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1149
 *          rpos += size
 *       elif code == 'N':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'N', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1150
 *       elif code == 'N':
 *          res.append( CigarOperation (
 *             'N', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )             # <<<<<<<<<<<<<<
 *          rpos += size
 *       elif code == 'S':
 */
      __pyx_t_11 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_6 = PyInt_FromLong((__pyx_v_rpos + __pyx_v_size)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__N));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_5, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_5, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_11 = 0;
      __pyx_t_10 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_3); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "HTSeq/_HTSeq.pyx":1151
 *          res.append( CigarOperation (
 *             'N', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size             # <<<<<<<<<<<<<<
 *       elif code == 'S':
 *          res.append( CigarOperation (
 */
      __pyx_v_rpos = (__pyx_v_rpos + __pyx_v_size);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1152
 *             'N', size, rpos, rpos + size, qpos, qpos, chrom, strand ) )
 *          rpos += size
 *       elif code == 'S':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'S', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__S), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1153
 *          rpos += size
 *       elif code == 'S':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'S', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1154
 *       elif code == 'S':
 *          res.append( CigarOperation (
 *             'S', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )             # <<<<<<<<<<<<<<
 *          qpos += size
 *       elif code == 'H':
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_size); 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_t_5 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyInt_FromLong((__pyx_v_qpos + __pyx_v_size)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__S));
      PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_n_s__S));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S));
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_11, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_11, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_10); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "HTSeq/_HTSeq.pyx":1155
 *          res.append( CigarOperation (
 *             'S', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size             # <<<<<<<<<<<<<<
 *       elif code == 'H':
 *          res.append( CigarOperation (
 */
      __pyx_v_qpos = (__pyx_v_qpos + __pyx_v_size);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1156
 *             'S', size, rpos, rpos, qpos, qpos + size, chrom, strand ) )
 *          qpos += size
 *       elif code == 'H':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'H', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__H), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1157
 *          qpos += size
 *       elif code == 'H':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'H', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 *       elif code == 'P':
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1158
 *       elif code == 'H':
 *          res.append( CigarOperation (
 *             'H', size, rpos, rpos, qpos, qpos, chrom, strand ) )             # <<<<<<<<<<<<<<
 *       elif code == 'P':
 *          res.append( CigarOperation (
 */
      __pyx_t_10 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyTuple_New(8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__H));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__H));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__H));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_3, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_5); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1159
 *          res.append( CigarOperation (
 *             'H', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 *       elif code == 'P':             # <<<<<<<<<<<<<<
 *          res.append( CigarOperation (
 *             'P', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 */
    __pyx_t_9 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_code), ((PyObject *)__pyx_n_s__P), Py_EQ); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_9) {

      /* "HTSeq/_HTSeq.pyx":1160
 *             'H', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 *       elif code == 'P':
 *          res.append( CigarOperation (             # <<<<<<<<<<<<<<
 *             'P', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 *       else:
 */
      if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }

      /* "HTSeq/_HTSeq.pyx":1161
 *       elif code == 'P':
 *          res.append( CigarOperation (
 *             'P', size, rpos, rpos, qpos, qpos, chrom, strand ) )             # <<<<<<<<<<<<<<
 *       else:
 *          raise ValueError, "Unknown CIGAR code '%s' encountered." % code
 */
      __pyx_t_5 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_rpos); 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);
      __pyx_t_4 = PyInt_FromLong(__pyx_v_rpos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = PyInt_FromLong(__pyx_v_qpos); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = PyTuple_New(8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__P));
      PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_n_s__P));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__P));
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_10, 6, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_10, 7, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_11 = 0;
      __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_CigarOperation)), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_res, __pyx_t_11); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1163
 *             'P', size, rpos, rpos, qpos, qpos, chrom, strand ) )
 *       else:
 *          raise ValueError, "Unknown CIGAR code '%s' encountered." % code             # <<<<<<<<<<<<<<
 *    return res
 * 
 */
      __pyx_t_11 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_86), ((PyObject *)__pyx_v_code)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_11), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1164
 *       else:
 *          raise ValueError, "Unknown CIGAR code '%s' encountered." % code
 *    return res             # <<<<<<<<<<<<<<
 * 
 * cdef _parse_SAM_optional_field_value( str field ):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = __pyx_v_res;
  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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("HTSeq._HTSeq.build_cigar_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1127
 *    return build_cigar_list( cl, ref_left, chrom, strand  )
 * 
 * cpdef list build_cigar_list( list cigar_pairs, int ref_left = 0, str chrom = "", str strand = "." ):             # <<<<<<<<<<<<<<
 *    cdef list split_cigar, res
 *    cdef int rpos, qpos, size
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_6build_cigar_list(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_6build_cigar_list(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cigar_pairs = 0;
  int __pyx_v_ref_left;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cigar_pairs,&__pyx_n_s__ref_left,&__pyx_n_s__chrom,&__pyx_n_s__strand,0};
  __Pyx_RefNannySetupContext("build_cigar_list");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject*)__pyx_kp_s_14);
    values[3] = ((PyObject*)__pyx_kp_s_11);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cigar_pairs);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref_left);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__strand);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "build_cigar_list") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cigar_pairs = ((PyObject*)values[0]);
    if (values[1]) {
      __pyx_v_ref_left = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_ref_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ref_left = ((int)0);
    }
    __pyx_v_chrom = ((PyObject*)values[2]);
    __pyx_v_strand = ((PyObject*)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("build_cigar_list", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.build_cigar_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cigar_pairs), (&PyList_Type), 1, "cigar_pairs", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyString_Type), 1, "chrom", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_strand), (&PyString_Type), 1, "strand", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.ref_left = __pyx_v_ref_left;
  __pyx_t_2.chrom = __pyx_v_chrom;
  __pyx_t_2.strand = __pyx_v_strand;
  __pyx_t_1 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_build_cigar_list(__pyx_v_cigar_pairs, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; __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("HTSeq._HTSeq.build_cigar_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1166
 *    return res
 * 
 * cdef _parse_SAM_optional_field_value( str field ):             # <<<<<<<<<<<<<<
 *    if len(field) < 5 or field[2] != ':' or field[4] != ':':
 *       raise ValueError, "Malformatted SAM optional field '%'" % field
 */

static PyObject *__pyx_f_5HTSeq_6_HTSeq__parse_SAM_optional_field_value(PyObject *__pyx_v_field) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  double __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_parse_SAM_optional_field_value");

  /* "HTSeq/_HTSeq.pyx":1167
 * 
 * cdef _parse_SAM_optional_field_value( str field ):
 *    if len(field) < 5 or field[2] != ':' or field[4] != ':':             # <<<<<<<<<<<<<<
 *       raise ValueError, "Malformatted SAM optional field '%'" % field
 *    if field[3] == 'A':
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_field)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 < 5);
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_kp_s_87), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_kp_s_87), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_5;
    } else {
      __pyx_t_6 = __pyx_t_4;
    }
    __pyx_t_4 = __pyx_t_6;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1168
 * cdef _parse_SAM_optional_field_value( str field ):
 *    if len(field) < 5 or field[2] != ':' or field[4] != ':':
 *       raise ValueError, "Malformatted SAM optional field '%'" % field             # <<<<<<<<<<<<<<
 *    if field[3] == 'A':
 *       return field[5]
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_88), ((PyObject *)__pyx_v_field)); 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_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), 0, 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "HTSeq/_HTSeq.pyx":1169
 *    if len(field) < 5 or field[2] != ':' or field[4] != ':':
 *       raise ValueError, "Malformatted SAM optional field '%'" % field
 *    if field[3] == 'A':             # <<<<<<<<<<<<<<
 *       return field[5]
 *    elif field[3] == 'i':
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__A), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1170
 *       raise ValueError, "Malformatted SAM optional field '%'" % field
 *    if field[3] == 'A':
 *       return field[5]             # <<<<<<<<<<<<<<
 *    elif field[3] == 'i':
 *       return int( field[5:] )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 5, sizeof(long), PyInt_FromLong); 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_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "HTSeq/_HTSeq.pyx":1171
 *    if field[3] == 'A':
 *       return field[5]
 *    elif field[3] == 'i':             # <<<<<<<<<<<<<<
 *       return int( field[5:] )
 *    elif field[3] == 'f':
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1172
 *       return field[5]
 *    elif field[3] == 'i':
 *       return int( field[5:] )             # <<<<<<<<<<<<<<
 *    elif field[3] == 'f':
 *       return float( field[5:] )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_field), 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __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 = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "HTSeq/_HTSeq.pyx":1173
 *    elif field[3] == 'i':
 *       return int( field[5:] )
 *    elif field[3] == 'f':             # <<<<<<<<<<<<<<
 *       return float( field[5:] )
 *    elif field[3] == 'Z':
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__f), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1174
 *       return int( field[5:] )
 *    elif field[3] == 'f':
 *       return float( field[5:] )             # <<<<<<<<<<<<<<
 *    elif field[3] == 'Z':
 *       return field[5:]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_field), 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_8 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "HTSeq/_HTSeq.pyx":1175
 *    elif field[3] == 'f':
 *       return float( field[5:] )
 *    elif field[3] == 'Z':             # <<<<<<<<<<<<<<
 *       return field[5:]
 *    elif field[3] == 'H':
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__Z), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1176
 *       return float( field[5:] )
 *    elif field[3] == 'Z':
 *       return field[5:]             # <<<<<<<<<<<<<<
 *    elif field[3] == 'H':
 *       return int( field[5:], 16 )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_field), 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_r = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }

  /* "HTSeq/_HTSeq.pyx":1177
 *    elif field[3] == 'Z':
 *       return field[5:]
 *    elif field[3] == 'H':             # <<<<<<<<<<<<<<
 *       return int( field[5:], 16 )
 *    else:
 */
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__H), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1178
 *       return field[5:]
 *    elif field[3] == 'H':
 *       return int( field[5:], 16 )             # <<<<<<<<<<<<<<
 *    else:
 *       raise ValueError, "SAM optional field with illegal type letter '%s'" % field[2]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_field), 5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_int_16);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_16);
    __Pyx_GIVEREF(__pyx_int_16);
    __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 = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1180
 *       return int( field[5:], 16 )
 *    else:
 *       raise ValueError, "SAM optional field with illegal type letter '%s'" % field[2]             # <<<<<<<<<<<<<<
 * 
 * cigar_operation_codes = [ 'M', 'I', 'D', 'N', 'S', 'H', 'P', '=', 'X']
 */
    __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_field), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_89), __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), 0, 0);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("HTSeq._HTSeq._parse_SAM_optional_field_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1195
 *    """
 * 
 *    def to_pysam_AlignedRead( self, sf ):             # <<<<<<<<<<<<<<
 *       try:
 *          import pysam
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_to_pysam_AlignedRead(PyObject *__pyx_v_self, PyObject *__pyx_v_sf); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_to_pysam_AlignedRead(PyObject *__pyx_v_self, PyObject *__pyx_v_sf) {
  PyObject *__pyx_v_pysam = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_c = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_pysam_AlignedRead");

  /* "HTSeq/_HTSeq.pyx":1196
 * 
 *    def to_pysam_AlignedRead( self, sf ):
 *       try:             # <<<<<<<<<<<<<<
 *          import pysam
 *       except ImportError:
 */
  {
    __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:*/ {

      /* "HTSeq/_HTSeq.pyx":1197
 *    def to_pysam_AlignedRead( self, sf ):
 *       try:
 *          import pysam             # <<<<<<<<<<<<<<
 *       except ImportError:
 *          sys.stderr.write( "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)" )
 */
      __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s__pysam), 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_pysam = __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;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":1198
 *       try:
 *          import pysam
 *       except ImportError:             # <<<<<<<<<<<<<<
 *          sys.stderr.write( "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)" )
 *          raise
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.to_pysam_AlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "HTSeq/_HTSeq.pyx":1199
 *          import pysam
 *       except ImportError:
 *          sys.stderr.write( "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)" )             # <<<<<<<<<<<<<<
 *          raise
 * 
 */
      __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__stderr); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_91), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "HTSeq/_HTSeq.pyx":1200
 *       except ImportError:
 *          sys.stderr.write( "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)" )
 *          raise             # <<<<<<<<<<<<<<
 * 
 *       a = pysam.AlignedRead()
 */
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_ErrRestore(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_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_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_L12_try_end:;
  }

  /* "HTSeq/_HTSeq.pyx":1202
 *          raise
 * 
 *       a = pysam.AlignedRead()             # <<<<<<<<<<<<<<
 *       a.seq = self.read.seq
 *       a.qual = self.read.qualstr
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_pysam, __pyx_n_s__AlignedRead); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_a = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "HTSeq/_HTSeq.pyx":1203
 * 
 *       a = pysam.AlignedRead()
 *       a.seq = self.read.seq             # <<<<<<<<<<<<<<
 *       a.qual = self.read.qualstr
 *       a.qname = self.read.name
 */
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__seq); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__seq, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "HTSeq/_HTSeq.pyx":1204
 *       a = pysam.AlignedRead()
 *       a.seq = self.read.seq
 *       a.qual = self.read.qualstr             # <<<<<<<<<<<<<<
 *       a.qname = self.read.name
 *       a.flag = self.flag
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__qualstr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__qual, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "HTSeq/_HTSeq.pyx":1205
 *       a.seq = self.read.seq
 *       a.qual = self.read.qualstr
 *       a.qname = self.read.name             # <<<<<<<<<<<<<<
 *       a.flag = self.flag
 *       a.tags = self.optional_fields
 */
  __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__name); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__qname, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "HTSeq/_HTSeq.pyx":1206
 *       a.qual = self.read.qualstr
 *       a.qname = self.read.name
 *       a.flag = self.flag             # <<<<<<<<<<<<<<
 *       a.tags = self.optional_fields
 *       if self.aligned:
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__flag, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "HTSeq/_HTSeq.pyx":1207
 *       a.qname = self.read.name
 *       a.flag = self.flag
 *       a.tags = self.optional_fields             # <<<<<<<<<<<<<<
 *       if self.aligned:
 *          a.cigar = [ (cigar_operation_code_dict[c.type], c.size) for c in self.cigar ]
 */
  if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__tags, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":1208
 *       a.flag = self.flag
 *       a.tags = self.optional_fields
 *       if self.aligned:             # <<<<<<<<<<<<<<
 *          a.cigar = [ (cigar_operation_code_dict[c.type], c.size) for c in self.cigar ]
 *          a.pos = self.iv.start
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__aligned); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_10) {

    /* "HTSeq/_HTSeq.pyx":1209
 *       a.tags = self.optional_fields
 *       if self.aligned:
 *          a.cigar = [ (cigar_operation_code_dict[c.type], c.size) for c in self.cigar ]             # <<<<<<<<<<<<<<
 *          a.pos = self.iv.start
 *          a.tid = sf.gettid( self.iv.chrom )
 */
    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_6 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar); __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
    for (;;) {
      if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++;
      __Pyx_XDECREF(__pyx_v_c);
      __pyx_v_c = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s_92); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__type); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyObject_GetItem(__pyx_t_4, __pyx_t_9); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_GetAttr(__pyx_v_c, __pyx_n_s__size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      if (unlikely(PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__cigar, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

    /* "HTSeq/_HTSeq.pyx":1210
 *       if self.aligned:
 *          a.cigar = [ (cigar_operation_code_dict[c.type], c.size) for c in self.cigar ]
 *          a.pos = self.iv.start             # <<<<<<<<<<<<<<
 *          a.tid = sf.gettid( self.iv.chrom )
 *          a.isize = self.inferred_insert_size
 */
    __pyx_t_7 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv->start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__pos, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "HTSeq/_HTSeq.pyx":1211
 *          a.cigar = [ (cigar_operation_code_dict[c.type], c.size) for c in self.cigar ]
 *          a.pos = self.iv.start
 *          a.tid = sf.gettid( self.iv.chrom )             # <<<<<<<<<<<<<<
 *          a.isize = self.inferred_insert_size
 *          a.mapq = self.aQual
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_sf, __pyx_n_s__gettid); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv->chrom));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv->chrom));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv->chrom));
    __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 = 1211; __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;
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__tid, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":1212
 *          a.pos = self.iv.start
 *          a.tid = sf.gettid( self.iv.chrom )
 *          a.isize = self.inferred_insert_size             # <<<<<<<<<<<<<<
 *          a.mapq = self.aQual
 *       else:
 */
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->inferred_insert_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__isize, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "HTSeq/_HTSeq.pyx":1213
 *          a.tid = sf.gettid( self.iv.chrom )
 *          a.isize = self.inferred_insert_size
 *          a.mapq = self.aQual             # <<<<<<<<<<<<<<
 *       else:
 *          a.pos  = -1
 */
    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->aQual); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__mapq, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L15;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1215
 *          a.mapq = self.aQual
 *       else:
 *          a.pos  = -1             # <<<<<<<<<<<<<<
 *          a.tid  = -1
 *       if self.mate_aligned:
 */
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__pos, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "HTSeq/_HTSeq.pyx":1216
 *       else:
 *          a.pos  = -1
 *          a.tid  = -1             # <<<<<<<<<<<<<<
 *       if self.mate_aligned:
 *          a.mrnm = sf.gettid( self.mate_start.chrom )
 */
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__tid, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L15:;

  /* "HTSeq/_HTSeq.pyx":1217
 *          a.pos  = -1
 *          a.tid  = -1
 *       if self.mate_aligned:             # <<<<<<<<<<<<<<
 *          a.mrnm = sf.gettid( self.mate_start.chrom )
 *          a.mpos = self.mate_start.start
 */
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__mate_aligned); 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);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_10) {

    /* "HTSeq/_HTSeq.pyx":1218
 *          a.tid  = -1
 *       if self.mate_aligned:
 *          a.mrnm = sf.gettid( self.mate_start.chrom )             # <<<<<<<<<<<<<<
 *          a.mpos = self.mate_start.start
 *       else:
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_sf, __pyx_n_s__gettid); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start->__pyx_base.chrom));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start->__pyx_base.chrom));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start->__pyx_base.chrom));
    __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 = 1218; __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;
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__mrnm, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "HTSeq/_HTSeq.pyx":1219
 *       if self.mate_aligned:
 *          a.mrnm = sf.gettid( self.mate_start.chrom )
 *          a.mpos = self.mate_start.start             # <<<<<<<<<<<<<<
 *       else:
 *          a.mrnm = -1
 */
    __pyx_t_7 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start->__pyx_base.start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__mpos, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L18;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1221
 *          a.mpos = self.mate_start.start
 *       else:
 *          a.mrnm = -1             # <<<<<<<<<<<<<<
 *          a.mpos = -1
 *       return a
 */
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__mrnm, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "HTSeq/_HTSeq.pyx":1222
 *       else:
 *          a.mrnm = -1
 *          a.mpos = -1             # <<<<<<<<<<<<<<
 *       return a
 * 
 */
    if (PyObject_SetAttr(__pyx_v_a, __pyx_n_s__mpos, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L18:;

  /* "HTSeq/_HTSeq.pyx":1223
 *          a.mrnm = -1
 *          a.mpos = -1
 *       return a             # <<<<<<<<<<<<<<
 * 
 *    @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_a);
  __pyx_r = __pyx_v_a;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.to_pysam_AlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pysam);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1226
 * 
 *    @classmethod
 *    def from_pysam_AlignedRead( cls, read, samfile ):             # <<<<<<<<<<<<<<
 *       strand = "-" if read.is_reverse else "+"
 *       if not read.is_unmapped:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_1from_pysam_AlignedRead(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_1from_pysam_AlignedRead(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_read = 0;
  PyObject *__pyx_v_samfile = 0;
  PyObject *__pyx_v_strand = NULL;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_iv = NULL;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_seq = NULL;
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *__pyx_v_a = NULL;
  PyObject *__pyx_v_code = NULL;
  PyObject *__pyx_v_length = 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;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_build_cigar_list __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__read,&__pyx_n_s__samfile,0};
  __Pyx_RefNannySetupContext("from_pysam_AlignedRead");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samfile);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("from_pysam_AlignedRead", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "from_pysam_AlignedRead") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_read = values[0];
    __pyx_v_samfile = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_pysam_AlignedRead", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.from_pysam_AlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "HTSeq/_HTSeq.pyx":1227
 *    @classmethod
 *    def from_pysam_AlignedRead( cls, read, samfile ):
 *       strand = "-" if read.is_reverse else "+"             # <<<<<<<<<<<<<<
 *       if not read.is_unmapped:
 *           chrom = samfile.getrname(read.tid)
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_reverse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
    __pyx_t_1 = __pyx_kp_s_38;
  } else {
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
    __pyx_t_1 = __pyx_kp_s_37;
  }
  __pyx_v_strand = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1228
 *    def from_pysam_AlignedRead( cls, read, samfile ):
 *       strand = "-" if read.is_reverse else "+"
 *       if not read.is_unmapped:             # <<<<<<<<<<<<<<
 *           chrom = samfile.getrname(read.tid)
 *           iv = GenomicInterval( chrom, read.pos, read.aend, strand )
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_unmapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __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 = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1229
 *       strand = "-" if read.is_reverse else "+"
 *       if not read.is_unmapped:
 *           chrom = samfile.getrname(read.tid)             # <<<<<<<<<<<<<<
 *           iv = GenomicInterval( chrom, read.pos, read.aend, strand )
 *       else:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_samfile, __pyx_n_s__getrname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__tid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_v_chrom = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "HTSeq/_HTSeq.pyx":1230
 *       if not read.is_unmapped:
 *           chrom = samfile.getrname(read.tid)
 *           iv = GenomicInterval( chrom, read.pos, read.aend, strand )             # <<<<<<<<<<<<<<
 *       else:
 *           iv = None
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__aend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_strand);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_strand);
    __Pyx_GIVEREF(__pyx_v_strand);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v_iv = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1232
 *           iv = GenomicInterval( chrom, read.pos, read.aend, strand )
 *       else:
 *           iv = None             # <<<<<<<<<<<<<<
 *       if read.qual != "*":
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual )
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_iv = Py_None;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":1233
 *       else:
 *           iv = None
 *       if read.qual != "*":             # <<<<<<<<<<<<<<
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual )
 *       else:
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qual); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_5, ((PyObject *)__pyx_kp_s_93), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1234
 *           iv = None
 *       if read.qual != "*":
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual )             # <<<<<<<<<<<<<<
 *       else:
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual, "noquals" )
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__seq); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qual); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_v_seq = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1236
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual )
 *       else:
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual, "noquals" )             # <<<<<<<<<<<<<<
 *       a = SAM_Alignment( seq, iv )
 *       a.cigar = build_cigar_list( [ (cigar_operation_codes[code], length) for (code, length) in read.cigar ] , read.pos, chrom, strand ) if iv != None else []
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__seq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qname); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__qual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__noquals));
    PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_n_s__noquals));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__noquals));
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_v_seq = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L7:;

  /* "HTSeq/_HTSeq.pyx":1237
 *       else:
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual, "noquals" )
 *       a = SAM_Alignment( seq, iv )             # <<<<<<<<<<<<<<
 *       a.cigar = build_cigar_list( [ (cigar_operation_codes[code], length) for (code, length) in read.cigar ] , read.pos, chrom, strand ) if iv != None else []
 *       a.inferred_insert_size = read.isize
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_v_seq));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_seq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_seq));
  __Pyx_INCREF(__pyx_v_iv);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_iv);
  __Pyx_GIVEREF(__pyx_v_iv);
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_a = ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":1238
 *          seq = SequenceWithQualities( read.seq, read.qname, read.qual, "noquals" )
 *       a = SAM_Alignment( seq, iv )
 *       a.cigar = build_cigar_list( [ (cigar_operation_codes[code], length) for (code, length) in read.cigar ] , read.pos, chrom, strand ) if iv != None else []             # <<<<<<<<<<<<<<
 *       a.inferred_insert_size = read.isize
 *       a.aQual = read.mapq
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_iv, Py_None, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_6 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__cigar); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_t_2)) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++;
      } else if (PyTuple_CheckExact(__pyx_t_2)) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++;
      } else {
        __pyx_t_6 = __pyx_t_8(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L11_unpacking_done;
        __pyx_L10_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L11_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_code);
      __pyx_v_code = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_v_length);
      __pyx_v_length = __pyx_t_10;
      __pyx_t_10 = 0;
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s_94); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyObject_GetItem(__pyx_t_6, __pyx_v_code); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_length);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_length);
      __Pyx_GIVEREF(__pyx_v_length);
      __pyx_t_10 = 0;
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = ((PyObject *)__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_v_chrom)) { __Pyx_RaiseUnboundLocalError("chrom"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (!(likely(PyString_CheckExact(__pyx_v_chrom))||((__pyx_v_chrom) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_chrom)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_chrom;
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(PyString_CheckExact(__pyx_v_strand))||((__pyx_v_strand) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_strand)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __pyx_v_strand;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_14.__pyx_n = 3;
    __pyx_t_14.ref_left = __pyx_t_13;
    __pyx_t_14.chrom = ((PyObject*)__pyx_t_1);
    __pyx_t_14.strand = ((PyObject*)__pyx_t_6);
    __pyx_t_10 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_build_cigar_list(((PyObject*)__pyx_t_2), 0, &__pyx_t_14)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __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_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = __pyx_t_10;
    __pyx_t_10 = 0;
  } else {
    __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
    __pyx_t_5 = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __Pyx_GOTREF(__pyx_v_a->cigar);
  __Pyx_DECREF(((PyObject *)__pyx_v_a->cigar));
  __pyx_v_a->cigar = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":1239
 *       a = SAM_Alignment( seq, iv )
 *       a.cigar = build_cigar_list( [ (cigar_operation_codes[code], length) for (code, length) in read.cigar ] , read.pos, chrom, strand ) if iv != None else []
 *       a.inferred_insert_size = read.isize             # <<<<<<<<<<<<<<
 *       a.aQual = read.mapq
 *       a.flag = read.flag
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__isize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->inferred_insert_size = __pyx_t_13;

  /* "HTSeq/_HTSeq.pyx":1240
 *       a.cigar = build_cigar_list( [ (cigar_operation_codes[code], length) for (code, length) in read.cigar ] , read.pos, chrom, strand ) if iv != None else []
 *       a.inferred_insert_size = read.isize
 *       a.aQual = read.mapq             # <<<<<<<<<<<<<<
 *       a.flag = read.flag
 *       a.proper_pair = read.is_proper_pair
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__mapq); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->aQual = __pyx_t_13;

  /* "HTSeq/_HTSeq.pyx":1241
 *       a.inferred_insert_size = read.isize
 *       a.aQual = read.mapq
 *       a.flag = read.flag             # <<<<<<<<<<<<<<
 *       a.proper_pair = read.is_proper_pair
 *       a.not_primary_alignment = read.is_secondary
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__flag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetAttr(((PyObject *)__pyx_v_a), __pyx_n_s__flag, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":1242
 *       a.aQual = read.mapq
 *       a.flag = read.flag
 *       a.proper_pair = read.is_proper_pair             # <<<<<<<<<<<<<<
 *       a.not_primary_alignment = read.is_secondary
 *       a.failed_platform_qc = read.is_qcfail
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_proper_pair); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->proper_pair = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":1243
 *       a.flag = read.flag
 *       a.proper_pair = read.is_proper_pair
 *       a.not_primary_alignment = read.is_secondary             # <<<<<<<<<<<<<<
 *       a.failed_platform_qc = read.is_qcfail
 *       a.pcr_or_optical_duplicate = read.is_duplicate
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_secondary); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->not_primary_alignment = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":1244
 *       a.proper_pair = read.is_proper_pair
 *       a.not_primary_alignment = read.is_secondary
 *       a.failed_platform_qc = read.is_qcfail             # <<<<<<<<<<<<<<
 *       a.pcr_or_optical_duplicate = read.is_duplicate
 *       a.original_sam_line = ""
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_qcfail); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->failed_platform_qc = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":1245
 *       a.not_primary_alignment = read.is_secondary
 *       a.failed_platform_qc = read.is_qcfail
 *       a.pcr_or_optical_duplicate = read.is_duplicate             # <<<<<<<<<<<<<<
 *       a.original_sam_line = ""
 *       a.optional_fields = read.tags
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_duplicate); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_a->pcr_or_optical_duplicate = __pyx_t_4;

  /* "HTSeq/_HTSeq.pyx":1246
 *       a.failed_platform_qc = read.is_qcfail
 *       a.pcr_or_optical_duplicate = read.is_duplicate
 *       a.original_sam_line = ""             # <<<<<<<<<<<<<<
 *       a.optional_fields = read.tags
 *       if read.is_paired:
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
  __Pyx_GOTREF(__pyx_v_a->original_sam_line);
  __Pyx_DECREF(((PyObject *)__pyx_v_a->original_sam_line));
  __pyx_v_a->original_sam_line = __pyx_kp_s_14;

  /* "HTSeq/_HTSeq.pyx":1247
 *       a.pcr_or_optical_duplicate = read.is_duplicate
 *       a.original_sam_line = ""
 *       a.optional_fields = read.tags             # <<<<<<<<<<<<<<
 *       if read.is_paired:
 *          if read.is_proper_pair:
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__tags); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_a->optional_fields);
  __Pyx_DECREF(((PyObject *)__pyx_v_a->optional_fields));
  __pyx_v_a->optional_fields = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "HTSeq/_HTSeq.pyx":1248
 *       a.original_sam_line = ""
 *       a.optional_fields = read.tags
 *       if read.is_paired:             # <<<<<<<<<<<<<<
 *          if read.is_proper_pair:
 *             strand = "-" if read.mate_is_reverse else "+"
 */
  __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_paired); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1249
 *       a.optional_fields = read.tags
 *       if read.is_paired:
 *          if read.is_proper_pair:             # <<<<<<<<<<<<<<
 *             strand = "-" if read.mate_is_reverse else "+"
 *             a.mate_start = GenomicPosition( samfile.getrname(read.mrnm), read.mpos, strand )
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_proper_pair); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1250
 *       if read.is_paired:
 *          if read.is_proper_pair:
 *             strand = "-" if read.mate_is_reverse else "+"             # <<<<<<<<<<<<<<
 *             a.mate_start = GenomicPosition( samfile.getrname(read.mrnm), read.mpos, strand )
 *             if read.is_read1:
 */
      __pyx_t_10 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__mate_is_reverse); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
        __pyx_t_5 = __pyx_kp_s_38;
      } else {
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
        __pyx_t_5 = __pyx_kp_s_37;
      }
      __Pyx_DECREF(__pyx_v_strand);
      __pyx_v_strand = ((PyObject *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "HTSeq/_HTSeq.pyx":1251
 *          if read.is_proper_pair:
 *             strand = "-" if read.mate_is_reverse else "+"
 *             a.mate_start = GenomicPosition( samfile.getrname(read.mrnm), read.mpos, strand )             # <<<<<<<<<<<<<<
 *             if read.is_read1:
 *                a.pe_which = intern( "first" )
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_samfile, __pyx_n_s__getrname); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__mrnm); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__mpos); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_strand);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_strand);
      __Pyx_GIVEREF(__pyx_v_strand);
      __pyx_t_10 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_v_a->mate_start);
      __Pyx_DECREF(((PyObject *)__pyx_v_a->mate_start));
      __pyx_v_a->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "HTSeq/_HTSeq.pyx":1252
 *             strand = "-" if read.mate_is_reverse else "+"
 *             a.mate_start = GenomicPosition( samfile.getrname(read.mrnm), read.mpos, strand )
 *             if read.is_read1:             # <<<<<<<<<<<<<<
 *                a.pe_which = intern( "first" )
 *             elif read.is_read2:
 */
      __pyx_t_6 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_read1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_4) {

        /* "HTSeq/_HTSeq.pyx":1253
 *             a.mate_start = GenomicPosition( samfile.getrname(read.mrnm), read.mpos, strand )
 *             if read.is_read1:
 *                a.pe_which = intern( "first" )             # <<<<<<<<<<<<<<
 *             elif read.is_read2:
 *                a.pe_which = intern( "second" )
 */
        __pyx_t_6 = ((PyObject *)__pyx_n_s__first);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_Intern(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        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 = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_v_a->pe_which);
        __Pyx_DECREF(((PyObject *)__pyx_v_a->pe_which));
        __pyx_v_a->pe_which = ((PyObject*)__pyx_t_5);
        __pyx_t_5 = 0;
        goto __pyx_L14;
      }

      /* "HTSeq/_HTSeq.pyx":1254
 *             if read.is_read1:
 *                a.pe_which = intern( "first" )
 *             elif read.is_read2:             # <<<<<<<<<<<<<<
 *                a.pe_which = intern( "second" )
 *             else:
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_read, __pyx_n_s__is_read2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {

        /* "HTSeq/_HTSeq.pyx":1255
 *                a.pe_which = intern( "first" )
 *             elif read.is_read2:
 *                a.pe_which = intern( "second" )             # <<<<<<<<<<<<<<
 *             else:
 *                a.pe_which = intern( "unknown" )
 */
        __pyx_t_5 = ((PyObject *)__pyx_n_s__second);
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_Intern(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GIVEREF(__pyx_t_6);
        __Pyx_GOTREF(__pyx_v_a->pe_which);
        __Pyx_DECREF(((PyObject *)__pyx_v_a->pe_which));
        __pyx_v_a->pe_which = ((PyObject*)__pyx_t_6);
        __pyx_t_6 = 0;
        goto __pyx_L14;
      }
      /*else*/ {

        /* "HTSeq/_HTSeq.pyx":1257
 *                a.pe_which = intern( "second" )
 *             else:
 *                a.pe_which = intern( "unknown" )             # <<<<<<<<<<<<<<
 *       else:
 *          a.pe_which = intern( "not_paired_end" )
 */
        __pyx_t_6 = ((PyObject *)__pyx_n_s__unknown);
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_Intern(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        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 = 1257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_v_a->pe_which);
        __Pyx_DECREF(((PyObject *)__pyx_v_a->pe_which));
        __pyx_v_a->pe_which = ((PyObject*)__pyx_t_5);
        __pyx_t_5 = 0;
      }
      __pyx_L14:;
      goto __pyx_L13;
    }
    __pyx_L13:;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1259
 *                a.pe_which = intern( "unknown" )
 *       else:
 *          a.pe_which = intern( "not_paired_end" )             # <<<<<<<<<<<<<<
 *       return a
 * 
 */
    __pyx_t_5 = ((PyObject *)__pyx_n_s__not_paired_end);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_Intern(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_v_a->pe_which);
    __Pyx_DECREF(((PyObject *)__pyx_v_a->pe_which));
    __pyx_v_a->pe_which = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;
  }
  __pyx_L12:;

  /* "HTSeq/_HTSeq.pyx":1260
 *       else:
 *          a.pe_which = intern( "not_paired_end" )
 *       return a             # <<<<<<<<<<<<<<
 * 
 *    @classmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_a));
  __pyx_r = ((PyObject *)__pyx_v_a);
  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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.from_pysam_AlignedRead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_iv);
  __Pyx_XDECREF((PyObject *)__pyx_v_seq);
  __Pyx_XDECREF((PyObject *)__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1263
 * 
 *    @classmethod
 *    def from_SAM_line( cls, line ):             # <<<<<<<<<<<<<<
 *       cdef str qname, flag, rname, pos, mapq, cigar,
 *       cdef str mrnm, mpos, isize, seq, qual
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_2from_SAM_line(PyObject *__pyx_v_cls, PyObject *__pyx_v_line); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_2from_SAM_line(PyObject *__pyx_v_cls, PyObject *__pyx_v_line) {
  PyObject *__pyx_v_qname = 0;
  PyObject *__pyx_v_flag = 0;
  PyObject *__pyx_v_rname = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_mapq = 0;
  PyObject *__pyx_v_cigar = 0;
  PyObject *__pyx_v_mrnm = 0;
  PyObject *__pyx_v_mpos = 0;
  PyObject *__pyx_v_isize = 0;
  PyObject *__pyx_v_seq = 0;
  PyObject *__pyx_v_qual = 0;
  PyObject *__pyx_v_optional_fields = 0;
  int __pyx_v_posint;
  int __pyx_v_flagint;
  PyObject *__pyx_v_strand = 0;
  PyObject *__pyx_v_cigarlist = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *__pyx_v_swq = 0;
  PyObject *__pyx_v_fields = NULL;
  PyObject *__pyx_v_iv = NULL;
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *__pyx_v_alnmt = NULL;
  PyObject *__pyx_v_field = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_t_17;
  long __pyx_t_18;
  struct __pyx_opt_args_5HTSeq_6_HTSeq_parse_cigar __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_SAM_line");

  /* "HTSeq/_HTSeq.pyx":1272
 *       cdef SequenceWithQualities swq
 * 
 *       fields = line.rstrip().split( "\t" )             # <<<<<<<<<<<<<<
 *       if len( fields ) < 10:
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_line, __pyx_n_s__rstrip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __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 = 1272; __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_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __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 = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_fields = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1273
 * 
 *       fields = line.rstrip().split( "\t" )
 *       if len( fields ) < 10:             # <<<<<<<<<<<<<<
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."
 *       (qname, flag, rname, pos, mapq, cigar, mrnm, mpos, isize,
 */
  __pyx_t_3 = PyObject_Length(__pyx_v_fields); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_3 < 10);
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1274
 *       fields = line.rstrip().split( "\t" )
 *       if len( fields ) < 10:
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."             # <<<<<<<<<<<<<<
 *       (qname, flag, rname, pos, mapq, cigar, mrnm, mpos, isize,
 *          seq, qual) = fields[ 0:11 ]
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_96), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":1276
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."
 *       (qname, flag, rname, pos, mapq, cigar, mrnm, mpos, isize,
 *          seq, qual) = fields[ 0:11 ]             # <<<<<<<<<<<<<<
 *       optional_fields = fields[ 11: ]
 * 
 */
  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 0, 11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 11)) {
        if (PyTuple_GET_SIZE(sequence) > 11) __Pyx_RaiseTooManyValuesError(11);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyTuple_GET_ITEM(sequence, 7); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 8); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 9); 
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 10); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 11)) {
        if (PyList_GET_SIZE(sequence) > 11) __Pyx_RaiseTooManyValuesError(11);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_11 = PyList_GET_ITEM(sequence, 7); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 8); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 9); 
      __pyx_t_14 = PyList_GET_ITEM(sequence, 10); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_15 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 3; __pyx_t_7 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 4; __pyx_t_8 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 5; __pyx_t_9 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_9);
    index = 6; __pyx_t_10 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_10)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_10);
    index = 7; __pyx_t_11 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_11)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_11);
    index = 8; __pyx_t_12 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_12)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_12);
    index = 9; __pyx_t_13 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_13)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_13);
    index = 10; __pyx_t_14 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_14);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }

  /* "HTSeq/_HTSeq.pyx":1275
 *       if len( fields ) < 10:
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."
 *       (qname, flag, rname, pos, mapq, cigar, mrnm, mpos, isize,             # <<<<<<<<<<<<<<
 *          seq, qual) = fields[ 0:11 ]
 *       optional_fields = fields[ 11: ]
 */
  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 = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  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 = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_8)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_9)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_10)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_11)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_12))||((__pyx_t_12) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_12)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_13)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(PyString_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_14)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_qname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_flag = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_rname = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_v_pos = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_v_mapq = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_v_cigar = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_v_mrnm = ((PyObject*)__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_v_mpos = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;
  __pyx_v_isize = ((PyObject*)__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_v_seq = ((PyObject*)__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_v_qual = ((PyObject*)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "HTSeq/_HTSeq.pyx":1277
 *       (qname, flag, rname, pos, mapq, cigar, mrnm, mpos, isize,
 *          seq, qual) = fields[ 0:11 ]
 *       optional_fields = fields[ 11: ]             # <<<<<<<<<<<<<<
 * 
 *       if seq.count( "=" ) > 0:
 */
  __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_fields, 11, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  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 = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_optional_fields = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1279
 *       optional_fields = fields[ 11: ]
 * 
 *       if seq.count( "=" ) > 0:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."
 *       if seq.count( "." ) > 0:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_seq), __pyx_n_s__count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_98), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_14, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1280
 * 
 *       if seq.count( "=" ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."             # <<<<<<<<<<<<<<
 *       if seq.count( "." ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '.', which is not supported."
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_99), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "HTSeq/_HTSeq.pyx":1281
 *       if seq.count( "=" ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."
 *       if seq.count( "." ) > 0:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Sequence in SAM file contains '.', which is not supported."
 *       flagint = int( flag )
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_seq), __pyx_n_s__count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_100), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_14, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1282
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."
 *       if seq.count( "." ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '.', which is not supported."             # <<<<<<<<<<<<<<
 *       flagint = int( flag )
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_101), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "HTSeq/_HTSeq.pyx":1283
 *       if seq.count( "." ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '.', which is not supported."
 *       flagint = int( flag )             # <<<<<<<<<<<<<<
 * 
 *       if flagint & 0x0004:     # flag "query sequence is unmapped"
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_flag));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_flag));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_flag));
  __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_14); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_v_flagint = __pyx_t_17;

  /* "HTSeq/_HTSeq.pyx":1285
 *       flagint = int( flag )
 * 
 *       if flagint & 0x0004:     # flag "query sequence is unmapped"             # <<<<<<<<<<<<<<
 *          iv = None
 *          cigarlist = None
 */
  __pyx_t_18 = (__pyx_v_flagint & 0x0004);
  if (__pyx_t_18) {

    /* "HTSeq/_HTSeq.pyx":1286
 * 
 *       if flagint & 0x0004:     # flag "query sequence is unmapped"
 *          iv = None             # <<<<<<<<<<<<<<
 *          cigarlist = None
 *          if rname != "*":     # flag "query sequence is unmapped"
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_iv = Py_None;

    /* "HTSeq/_HTSeq.pyx":1287
 *       if flagint & 0x0004:     # flag "query sequence is unmapped"
 *          iv = None
 *          cigarlist = None             # <<<<<<<<<<<<<<
 *          if rname != "*":     # flag "query sequence is unmapped"
 *             warnings.warn( "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set" )
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_cigarlist = ((PyObject*)Py_None);

    /* "HTSeq/_HTSeq.pyx":1288
 *          iv = None
 *          cigarlist = None
 *          if rname != "*":     # flag "query sequence is unmapped"             # <<<<<<<<<<<<<<
 *             warnings.warn( "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set" )
 *       else:
 */
    __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_rname), ((PyObject *)__pyx_kp_s_93), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1289
 *          cigarlist = None
 *          if rname != "*":     # flag "query sequence is unmapped"
 *             warnings.warn( "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set" )             # <<<<<<<<<<<<<<
 *       else:
 *          if rname == "*":
 */
      __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_103), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1291
 *             warnings.warn( "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set" )
 *       else:
 *          if rname == "*":             # <<<<<<<<<<<<<<
 *             raise ValueError, "Malformed SAM line: RNAME == '*' although flag bit &0x0004 cleared"
 *          posint = int( pos ) - 1   # SAM is one-based, but HTSeq is zero-based!
 */
    __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_rname), ((PyObject *)__pyx_kp_s_93), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "HTSeq/_HTSeq.pyx":1292
 *       else:
 *          if rname == "*":
 *             raise ValueError, "Malformed SAM line: RNAME == '*' although flag bit &0x0004 cleared"             # <<<<<<<<<<<<<<
 *          posint = int( pos ) - 1   # SAM is one-based, but HTSeq is zero-based!
 *          if flagint & 0x0010:      # flag "strand of the query"
 */
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_104), 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "HTSeq/_HTSeq.pyx":1293
 *          if rname == "*":
 *             raise ValueError, "Malformed SAM line: RNAME == '*' although flag bit &0x0004 cleared"
 *          posint = int( pos ) - 1   # SAM is one-based, but HTSeq is zero-based!             # <<<<<<<<<<<<<<
 *          if flagint & 0x0010:      # flag "strand of the query"
 *             strand = "-"
 */
    __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(((PyObject *)__pyx_v_pos));
    PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_pos));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_14); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_posint = __pyx_t_17;

    /* "HTSeq/_HTSeq.pyx":1294
 *             raise ValueError, "Malformed SAM line: RNAME == '*' although flag bit &0x0004 cleared"
 *          posint = int( pos ) - 1   # SAM is one-based, but HTSeq is zero-based!
 *          if flagint & 0x0010:      # flag "strand of the query"             # <<<<<<<<<<<<<<
 *             strand = "-"
 *          else:
 */
    __pyx_t_18 = (__pyx_v_flagint & 0x0010);
    if (__pyx_t_18) {

      /* "HTSeq/_HTSeq.pyx":1295
 *          posint = int( pos ) - 1   # SAM is one-based, but HTSeq is zero-based!
 *          if flagint & 0x0010:      # flag "strand of the query"
 *             strand = "-"             # <<<<<<<<<<<<<<
 *          else:
 *             strand = "+"
 */
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      __pyx_v_strand = __pyx_kp_s_38;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1297
 *             strand = "-"
 *          else:
 *             strand = "+"             # <<<<<<<<<<<<<<
 *          cigarlist = parse_cigar( cigar, posint, rname, strand )
 *          iv = GenomicInterval( rname, posint, cigarlist[-1].ref_iv.end, strand )
 */
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
      __pyx_v_strand = __pyx_kp_s_37;
    }
    __pyx_L13:;

    /* "HTSeq/_HTSeq.pyx":1298
 *          else:
 *             strand = "+"
 *          cigarlist = parse_cigar( cigar, posint, rname, strand )             # <<<<<<<<<<<<<<
 *          iv = GenomicInterval( rname, posint, cigarlist[-1].ref_iv.end, strand )
 * 
 */
    __pyx_t_19.__pyx_n = 3;
    __pyx_t_19.ref_left = __pyx_v_posint;
    __pyx_t_19.chrom = __pyx_v_rname;
    __pyx_t_19.strand = __pyx_v_strand;
    __pyx_t_14 = ((PyObject *)__pyx_f_5HTSeq_6_HTSeq_parse_cigar(__pyx_v_cigar, 0, &__pyx_t_19)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_v_cigarlist = ((PyObject*)__pyx_t_14);
    __pyx_t_14 = 0;

    /* "HTSeq/_HTSeq.pyx":1299
 *             strand = "+"
 *          cigarlist = parse_cigar( cigar, posint, rname, strand )
 *          iv = GenomicInterval( rname, posint, cigarlist[-1].ref_iv.end, strand )             # <<<<<<<<<<<<<<
 * 
 *       if qual != "*":
 */
    __pyx_t_14 = PyInt_FromLong(__pyx_v_posint); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_cigarlist), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_13 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ref_iv); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
    __Pyx_INCREF(((PyObject *)__pyx_v_rname));
    PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_rname));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rname));
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_strand));
    PyTuple_SET_ITEM(__pyx_t_13, 3, ((PyObject *)__pyx_v_strand));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
    __pyx_t_14 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval)), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_v_iv = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L10:;

  /* "HTSeq/_HTSeq.pyx":1301
 *          iv = GenomicInterval( rname, posint, cigarlist[-1].ref_iv.end, strand )
 * 
 *       if qual != "*":             # <<<<<<<<<<<<<<
 *          swq = SequenceWithQualities( seq.upper(), qname, qual )
 *       else:
 */
  __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_qual), ((PyObject *)__pyx_kp_s_93), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "HTSeq/_HTSeq.pyx":1302
 * 
 *       if qual != "*":
 *          swq = SequenceWithQualities( seq.upper(), qname, qual )             # <<<<<<<<<<<<<<
 *       else:
 *          swq = SequenceWithQualities( seq.upper(), qname, "", "noquals" )
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_seq), __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    __Pyx_INCREF(((PyObject *)__pyx_v_qname));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_qname));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_qname));
    __Pyx_INCREF(((PyObject *)__pyx_v_qual));
    PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_qual));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_qual));
    __pyx_t_13 = 0;
    __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_swq = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_13);
    __pyx_t_13 = 0;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1304
 *          swq = SequenceWithQualities( seq.upper(), qname, qual )
 *       else:
 *          swq = SequenceWithQualities( seq.upper(), qname, "", "noquals" )             # <<<<<<<<<<<<<<
 * 
 *       alnmt = SAM_Alignment( swq, iv )
 */
    __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_seq), __pyx_n_s__upper); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_2 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyTuple_New(4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_13));
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_qname));
    PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_qname));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_qname));
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
    PyTuple_SET_ITEM(__pyx_t_13, 2, ((PyObject *)__pyx_kp_s_14));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
    __Pyx_INCREF(((PyObject *)__pyx_n_s__noquals));
    PyTuple_SET_ITEM(__pyx_t_13, 3, ((PyObject *)__pyx_n_s__noquals));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__noquals));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities)), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_v_swq = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L14:;

  /* "HTSeq/_HTSeq.pyx":1306
 *          swq = SequenceWithQualities( seq.upper(), qname, "", "noquals" )
 * 
 *       alnmt = SAM_Alignment( swq, iv )             # <<<<<<<<<<<<<<
 *       alnmt.flag = flagint
 *       alnmt.cigar = cigarlist
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_swq));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_swq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_swq));
  __Pyx_INCREF(__pyx_v_iv);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_iv);
  __Pyx_GIVEREF(__pyx_v_iv);
  __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_alnmt = ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "HTSeq/_HTSeq.pyx":1307
 * 
 *       alnmt = SAM_Alignment( swq, iv )
 *       alnmt.flag = flagint             # <<<<<<<<<<<<<<
 *       alnmt.cigar = cigarlist
 *       alnmt.optional_fields = [ ( field[:2], _parse_SAM_optional_field_value( field ) ) for field in optional_fields ]
 */
  __pyx_t_13 = PyInt_FromLong(__pyx_v_flagint); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  if (PyObject_SetAttr(((PyObject *)__pyx_v_alnmt), __pyx_n_s__flag, __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "HTSeq/_HTSeq.pyx":1308
 *       alnmt = SAM_Alignment( swq, iv )
 *       alnmt.flag = flagint
 *       alnmt.cigar = cigarlist             # <<<<<<<<<<<<<<
 *       alnmt.optional_fields = [ ( field[:2], _parse_SAM_optional_field_value( field ) ) for field in optional_fields ]
 *       alnmt.aQual = int( mapq )
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_cigarlist));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cigarlist));
  __Pyx_GOTREF(__pyx_v_alnmt->cigar);
  __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->cigar));
  __pyx_v_alnmt->cigar = __pyx_v_cigarlist;

  /* "HTSeq/_HTSeq.pyx":1309
 *       alnmt.flag = flagint
 *       alnmt.cigar = cigarlist
 *       alnmt.optional_fields = [ ( field[:2], _parse_SAM_optional_field_value( field ) ) for field in optional_fields ]             # <<<<<<<<<<<<<<
 *       alnmt.aQual = int( mapq )
 *       alnmt.inferred_insert_size = int( isize )
 */
  __pyx_t_13 = PyList_New(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  if (unlikely(((PyObject *)__pyx_v_optional_fields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = ((PyObject *)__pyx_v_optional_fields); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_14 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_14); __pyx_t_3++;
    __Pyx_XDECREF(__pyx_v_field);
    __pyx_v_field = __pyx_t_14;
    __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PySequence_GetSlice(__pyx_v_field, 0, 2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    if (!(likely(PyString_CheckExact(__pyx_v_field))||((__pyx_v_field) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_field)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __pyx_v_field;
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_11 = __pyx_f_5HTSeq_6_HTSeq__parse_SAM_optional_field_value(((PyObject*)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_12));
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    __pyx_t_14 = 0;
    __pyx_t_11 = 0;
    if (unlikely(PyList_Append(__pyx_t_13, (PyObject*)__pyx_t_12))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_13));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
  __Pyx_GOTREF(__pyx_v_alnmt->optional_fields);
  __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->optional_fields));
  __pyx_v_alnmt->optional_fields = __pyx_t_13;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;

  /* "HTSeq/_HTSeq.pyx":1310
 *       alnmt.cigar = cigarlist
 *       alnmt.optional_fields = [ ( field[:2], _parse_SAM_optional_field_value( field ) ) for field in optional_fields ]
 *       alnmt.aQual = int( mapq )             # <<<<<<<<<<<<<<
 *       alnmt.inferred_insert_size = int( isize )
 *       alnmt.original_sam_line = line
 */
  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __Pyx_INCREF(((PyObject *)__pyx_v_mapq));
  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_mapq));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_mapq));
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_alnmt->aQual = __pyx_t_17;

  /* "HTSeq/_HTSeq.pyx":1311
 *       alnmt.optional_fields = [ ( field[:2], _parse_SAM_optional_field_value( field ) ) for field in optional_fields ]
 *       alnmt.aQual = int( mapq )
 *       alnmt.inferred_insert_size = int( isize )             # <<<<<<<<<<<<<<
 *       alnmt.original_sam_line = line
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_v_isize));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_isize));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_isize));
  __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_13); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_v_alnmt->inferred_insert_size = __pyx_t_17;

  /* "HTSeq/_HTSeq.pyx":1312
 *       alnmt.aQual = int( mapq )
 *       alnmt.inferred_insert_size = int( isize )
 *       alnmt.original_sam_line = line             # <<<<<<<<<<<<<<
 * 
 *       if flagint & 0x0001:         # flag "read is paired in sequencing"
 */
  if (!(likely(PyString_CheckExact(__pyx_v_line))||((__pyx_v_line) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_line)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_line);
  __Pyx_GIVEREF(__pyx_v_line);
  __Pyx_GOTREF(__pyx_v_alnmt->original_sam_line);
  __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->original_sam_line));
  __pyx_v_alnmt->original_sam_line = ((PyObject*)__pyx_v_line);

  /* "HTSeq/_HTSeq.pyx":1314
 *       alnmt.original_sam_line = line
 * 
 *       if flagint & 0x0001:         # flag "read is paired in sequencing"             # <<<<<<<<<<<<<<
 *          if flagint & 0x0008:      # flag "mate is unmapped"
 *             if mrnm != "*":
 */
  __pyx_t_18 = (__pyx_v_flagint & 0x0001);
  if (__pyx_t_18) {

    /* "HTSeq/_HTSeq.pyx":1315
 * 
 *       if flagint & 0x0001:         # flag "read is paired in sequencing"
 *          if flagint & 0x0008:      # flag "mate is unmapped"             # <<<<<<<<<<<<<<
 *             if mrnm != "*":
 *                warnings.warn( "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set" )
 */
    __pyx_t_18 = (__pyx_v_flagint & 0x0008);
    if (__pyx_t_18) {

      /* "HTSeq/_HTSeq.pyx":1316
 *       if flagint & 0x0001:         # flag "read is paired in sequencing"
 *          if flagint & 0x0008:      # flag "mate is unmapped"
 *             if mrnm != "*":             # <<<<<<<<<<<<<<
 *                warnings.warn( "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set" )
 *             alnmt.mate_start = None
 */
      __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_mrnm), ((PyObject *)__pyx_kp_s_93), Py_NE); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "HTSeq/_HTSeq.pyx":1317
 *          if flagint & 0x0008:      # flag "mate is unmapped"
 *             if mrnm != "*":
 *                warnings.warn( "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set" )             # <<<<<<<<<<<<<<
 *             alnmt.mate_start = None
 *          else:
 */
        __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_106), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "HTSeq/_HTSeq.pyx":1318
 *             if mrnm != "*":
 *                warnings.warn( "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set" )
 *             alnmt.mate_start = None             # <<<<<<<<<<<<<<
 *          else:
 *             if mrnm == "*":
 */
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      __Pyx_GOTREF(__pyx_v_alnmt->mate_start);
      __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->mate_start));
      __pyx_v_alnmt->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)Py_None);
      goto __pyx_L18;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1320
 *             alnmt.mate_start = None
 *          else:
 *             if mrnm == "*":             # <<<<<<<<<<<<<<
 *                raise ValueError, "Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared"
 *             posint = int( mpos ) - 1
 */
      __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_mrnm), ((PyObject *)__pyx_kp_s_93), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "HTSeq/_HTSeq.pyx":1321
 *          else:
 *             if mrnm == "*":
 *                raise ValueError, "Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared"             # <<<<<<<<<<<<<<
 *             posint = int( mpos ) - 1
 *             if flagint & 0x0020:   # flag "strand of the mate"
 */
        __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_kp_s_107), 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "HTSeq/_HTSeq.pyx":1322
 *             if mrnm == "*":
 *                raise ValueError, "Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared"
 *             posint = int( mpos ) - 1             # <<<<<<<<<<<<<<
 *             if flagint & 0x0020:   # flag "strand of the mate"
 *                strand = "-"
 */
      __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
      __Pyx_INCREF(((PyObject *)__pyx_v_mpos));
      PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_mpos));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_mpos));
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __pyx_t_13 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_13); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_v_posint = __pyx_t_17;

      /* "HTSeq/_HTSeq.pyx":1323
 *                raise ValueError, "Malformed SAM line: MRNM == '*' although flag bit &0x0008 cleared"
 *             posint = int( mpos ) - 1
 *             if flagint & 0x0020:   # flag "strand of the mate"             # <<<<<<<<<<<<<<
 *                strand = "-"
 *             else:
 */
      __pyx_t_18 = (__pyx_v_flagint & 0x0020);
      if (__pyx_t_18) {

        /* "HTSeq/_HTSeq.pyx":1324
 *             posint = int( mpos ) - 1
 *             if flagint & 0x0020:   # flag "strand of the mate"
 *                strand = "-"             # <<<<<<<<<<<<<<
 *             else:
 *                strand = "+"
 */
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
        __Pyx_XDECREF(((PyObject *)__pyx_v_strand));
        __pyx_v_strand = __pyx_kp_s_38;
        goto __pyx_L21;
      }
      /*else*/ {

        /* "HTSeq/_HTSeq.pyx":1326
 *                strand = "-"
 *             else:
 *                strand = "+"             # <<<<<<<<<<<<<<
 *             alnmt.mate_start = GenomicPosition( mrnm, posint, strand )
 *             if alnmt.mate_start.chrom == "=":
 */
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
        __Pyx_XDECREF(((PyObject *)__pyx_v_strand));
        __pyx_v_strand = __pyx_kp_s_37;
      }
      __pyx_L21:;

      /* "HTSeq/_HTSeq.pyx":1327
 *             else:
 *                strand = "+"
 *             alnmt.mate_start = GenomicPosition( mrnm, posint, strand )             # <<<<<<<<<<<<<<
 *             if alnmt.mate_start.chrom == "=":
 *                if alnmt.iv is not None:
 */
      __pyx_t_13 = PyInt_FromLong(__pyx_v_posint); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_mrnm));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mrnm));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_mrnm));
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __Pyx_INCREF(((PyObject *)__pyx_v_strand));
      PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_strand));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_strand));
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_13);
      __Pyx_GOTREF(__pyx_v_alnmt->mate_start);
      __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->mate_start));
      __pyx_v_alnmt->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_t_13);
      __pyx_t_13 = 0;

      /* "HTSeq/_HTSeq.pyx":1328
 *                strand = "+"
 *             alnmt.mate_start = GenomicPosition( mrnm, posint, strand )
 *             if alnmt.mate_start.chrom == "=":             # <<<<<<<<<<<<<<
 *                if alnmt.iv is not None:
 *                   alnmt.mate_start.chrom = alnmt.iv.chrom
 */
      __pyx_t_4 = __Pyx_PyString_Equals(((PyObject *)__pyx_v_alnmt->mate_start->__pyx_base.chrom), ((PyObject *)__pyx_kp_s_97), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_4) {

        /* "HTSeq/_HTSeq.pyx":1329
 *             alnmt.mate_start = GenomicPosition( mrnm, posint, strand )
 *             if alnmt.mate_start.chrom == "=":
 *                if alnmt.iv is not None:             # <<<<<<<<<<<<<<
 *                   alnmt.mate_start.chrom = alnmt.iv.chrom
 *                else:
 */
        __pyx_t_4 = (((PyObject *)__pyx_v_alnmt->__pyx_base.__pyx_base.iv) != Py_None);
        if (__pyx_t_4) {

          /* "HTSeq/_HTSeq.pyx":1330
 *             if alnmt.mate_start.chrom == "=":
 *                if alnmt.iv is not None:
 *                   alnmt.mate_start.chrom = alnmt.iv.chrom             # <<<<<<<<<<<<<<
 *                else:
 *                   warnings.warn( "Malformed SAM line: MRNM == '=' although read is not aligned." )
 */
          __Pyx_INCREF(((PyObject *)__pyx_v_alnmt->__pyx_base.__pyx_base.iv->chrom));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_alnmt->__pyx_base.__pyx_base.iv->chrom));
          __Pyx_GOTREF(__pyx_v_alnmt->mate_start->__pyx_base.chrom);
          __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->mate_start->__pyx_base.chrom));
          __pyx_v_alnmt->mate_start->__pyx_base.chrom = __pyx_v_alnmt->__pyx_base.__pyx_base.iv->chrom;
          goto __pyx_L23;
        }
        /*else*/ {

          /* "HTSeq/_HTSeq.pyx":1332
 *                   alnmt.mate_start.chrom = alnmt.iv.chrom
 *                else:
 *                   warnings.warn( "Malformed SAM line: MRNM == '=' although read is not aligned." )             # <<<<<<<<<<<<<<
 *          if flagint & 0x0040:
 *             alnmt.pe_which = intern( "first" )
 */
          __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_2 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __pyx_L23:;
        goto __pyx_L22;
      }
      __pyx_L22:;
    }
    __pyx_L18:;

    /* "HTSeq/_HTSeq.pyx":1333
 *                else:
 *                   warnings.warn( "Malformed SAM line: MRNM == '=' although read is not aligned." )
 *          if flagint & 0x0040:             # <<<<<<<<<<<<<<
 *             alnmt.pe_which = intern( "first" )
 *          elif flagint & 0x0080:
 */
    __pyx_t_18 = (__pyx_v_flagint & 0x0040);
    if (__pyx_t_18) {

      /* "HTSeq/_HTSeq.pyx":1334
 *                   warnings.warn( "Malformed SAM line: MRNM == '=' although read is not aligned." )
 *          if flagint & 0x0040:
 *             alnmt.pe_which = intern( "first" )             # <<<<<<<<<<<<<<
 *          elif flagint & 0x0080:
 *             alnmt.pe_which = intern( "second" )
 */
      __pyx_t_13 = ((PyObject *)__pyx_n_s__first);
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_2 = __Pyx_Intern(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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 = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_alnmt->pe_which);
      __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->pe_which));
      __pyx_v_alnmt->pe_which = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L24;
    }

    /* "HTSeq/_HTSeq.pyx":1335
 *          if flagint & 0x0040:
 *             alnmt.pe_which = intern( "first" )
 *          elif flagint & 0x0080:             # <<<<<<<<<<<<<<
 *             alnmt.pe_which = intern( "second" )
 *          else:
 */
    __pyx_t_18 = (__pyx_v_flagint & 0x0080);
    if (__pyx_t_18) {

      /* "HTSeq/_HTSeq.pyx":1336
 *             alnmt.pe_which = intern( "first" )
 *          elif flagint & 0x0080:
 *             alnmt.pe_which = intern( "second" )             # <<<<<<<<<<<<<<
 *          else:
 *             alnmt.pe_which = intern( "unknown" )
 */
      __pyx_t_2 = ((PyObject *)__pyx_n_s__second);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_13 = __Pyx_Intern(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyString_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_13)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_13);
      __Pyx_GOTREF(__pyx_v_alnmt->pe_which);
      __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->pe_which));
      __pyx_v_alnmt->pe_which = ((PyObject*)__pyx_t_13);
      __pyx_t_13 = 0;
      goto __pyx_L24;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1338
 *             alnmt.pe_which = intern( "second" )
 *          else:
 *             alnmt.pe_which = intern( "unknown" )             # <<<<<<<<<<<<<<
 *       else:
 *          alnmt.mate_start = None
 */
      __pyx_t_13 = ((PyObject *)__pyx_n_s__unknown);
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_2 = __Pyx_Intern(__pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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 = 1338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_alnmt->pe_which);
      __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->pe_which));
      __pyx_v_alnmt->pe_which = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L24:;
    goto __pyx_L17;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1340
 *             alnmt.pe_which = intern( "unknown" )
 *       else:
 *          alnmt.mate_start = None             # <<<<<<<<<<<<<<
 *          alnmt.pe_which = intern( "not_paired_end" )
 * 
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_alnmt->mate_start);
    __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->mate_start));
    __pyx_v_alnmt->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)Py_None);

    /* "HTSeq/_HTSeq.pyx":1341
 *       else:
 *          alnmt.mate_start = None
 *          alnmt.pe_which = intern( "not_paired_end" )             # <<<<<<<<<<<<<<
 * 
 *       alnmt.proper_pair = flagint & 0x0002 > 0
 */
    __pyx_t_2 = ((PyObject *)__pyx_n_s__not_paired_end);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_13 = __Pyx_Intern(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(PyString_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_13)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GIVEREF(__pyx_t_13);
    __Pyx_GOTREF(__pyx_v_alnmt->pe_which);
    __Pyx_DECREF(((PyObject *)__pyx_v_alnmt->pe_which));
    __pyx_v_alnmt->pe_which = ((PyObject*)__pyx_t_13);
    __pyx_t_13 = 0;
  }
  __pyx_L17:;

  /* "HTSeq/_HTSeq.pyx":1343
 *          alnmt.pe_which = intern( "not_paired_end" )
 * 
 *       alnmt.proper_pair = flagint & 0x0002 > 0             # <<<<<<<<<<<<<<
 *       alnmt.not_primary_alignment = flagint & 0x0100 > 0
 *       alnmt.failed_platform_qc = flagint & 0x0200 > 0
 */
  __pyx_v_alnmt->proper_pair = ((__pyx_v_flagint & 0x0002) > 0);

  /* "HTSeq/_HTSeq.pyx":1344
 * 
 *       alnmt.proper_pair = flagint & 0x0002 > 0
 *       alnmt.not_primary_alignment = flagint & 0x0100 > 0             # <<<<<<<<<<<<<<
 *       alnmt.failed_platform_qc = flagint & 0x0200 > 0
 *       alnmt.pcr_or_optical_duplicate = flagint & 0x0400 > 0
 */
  __pyx_v_alnmt->not_primary_alignment = ((__pyx_v_flagint & 0x0100) > 0);

  /* "HTSeq/_HTSeq.pyx":1345
 *       alnmt.proper_pair = flagint & 0x0002 > 0
 *       alnmt.not_primary_alignment = flagint & 0x0100 > 0
 *       alnmt.failed_platform_qc = flagint & 0x0200 > 0             # <<<<<<<<<<<<<<
 *       alnmt.pcr_or_optical_duplicate = flagint & 0x0400 > 0
 * 
 */
  __pyx_v_alnmt->failed_platform_qc = ((__pyx_v_flagint & 0x0200) > 0);

  /* "HTSeq/_HTSeq.pyx":1346
 *       alnmt.not_primary_alignment = flagint & 0x0100 > 0
 *       alnmt.failed_platform_qc = flagint & 0x0200 > 0
 *       alnmt.pcr_or_optical_duplicate = flagint & 0x0400 > 0             # <<<<<<<<<<<<<<
 * 
 *       return alnmt
 */
  __pyx_v_alnmt->pcr_or_optical_duplicate = ((__pyx_v_flagint & 0x0400) > 0);

  /* "HTSeq/_HTSeq.pyx":1348
 *       alnmt.pcr_or_optical_duplicate = flagint & 0x0400 > 0
 * 
 *       return alnmt             # <<<<<<<<<<<<<<
 * 
 *    property flag:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_alnmt));
  __pyx_r = ((PyObject *)__pyx_v_alnmt);
  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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.from_SAM_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_qname);
  __Pyx_XDECREF(__pyx_v_flag);
  __Pyx_XDECREF(__pyx_v_rname);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_mapq);
  __Pyx_XDECREF(__pyx_v_cigar);
  __Pyx_XDECREF(__pyx_v_mrnm);
  __Pyx_XDECREF(__pyx_v_mpos);
  __Pyx_XDECREF(__pyx_v_isize);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_qual);
  __Pyx_XDECREF(__pyx_v_optional_fields);
  __Pyx_XDECREF(__pyx_v_strand);
  __Pyx_XDECREF(__pyx_v_cigarlist);
  __Pyx_XDECREF((PyObject *)__pyx_v_swq);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_iv);
  __Pyx_XDECREF((PyObject *)__pyx_v_alnmt);
  __Pyx_XDECREF(__pyx_v_field);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1351
 * 
 *    property flag:
 *       def __get__( self ):             # <<<<<<<<<<<<<<
 *          return self._flag
 *       def __set__( self, value ):
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag___get__(PyObject *__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__");

  /* "HTSeq/_HTSeq.pyx":1352
 *    property flag:
 *       def __get__( self ):
 *          return self._flag             # <<<<<<<<<<<<<<
 *       def __set__( self, value ):
 *          self._flag = value
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->_flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __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("HTSeq._HTSeq.SAM_Alignment.flag.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1353
 *       def __get__( self ):
 *          return self._flag
 *       def __set__( self, value ):             # <<<<<<<<<<<<<<
 *          self._flag = value
 * 
 */

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag_1__set__(PyObject *__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__");

  /* "HTSeq/_HTSeq.pyx":1354
 *          return self._flag
 *       def __set__( self, value ):
 *          self._flag = value             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
  __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 = 1354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->_flag = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.flag.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1357
 * 
 *    @property
 *    def paired_end( self ):             # <<<<<<<<<<<<<<
 *       return self.pe_which != "not_paired_end"
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_3paired_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_3paired_end(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("paired_end");

  /* "HTSeq/_HTSeq.pyx":1358
 *    @property
 *    def paired_end( self ):
 *       return self.pe_which != "not_paired_end"             # <<<<<<<<<<<<<<
 * 
 *    @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyString_Equals(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which), ((PyObject *)__pyx_n_s__not_paired_end), Py_NE); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.paired_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1361
 * 
 *    @property
 *    def mate_aligned( self ):             # <<<<<<<<<<<<<<
 *       return self.mate_start is not None
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4mate_aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4mate_aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mate_aligned");

  /* "HTSeq/_HTSeq.pyx":1362
 *    @property
 *    def mate_aligned( self ):
 *       return self.mate_start is not None             # <<<<<<<<<<<<<<
 * 
 *    def get_sam_line( self ):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = (((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start) != Py_None);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.mate_aligned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1364
 *       return self.mate_start is not None
 * 
 *    def get_sam_line( self ):             # <<<<<<<<<<<<<<
 *       cdef str cigar = ""
 *       cdef GenomicInterval query_start, mate_start
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5get_sam_line(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5get_sam_line(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_cigar = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_query_start = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *__pyx_v_mate_start = 0;
  struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *__pyx_v_cop = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  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 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sam_line");

  /* "HTSeq/_HTSeq.pyx":1365
 * 
 *    def get_sam_line( self ):
 *       cdef str cigar = ""             # <<<<<<<<<<<<<<
 *       cdef GenomicInterval query_start, mate_start
 *       cdef CigarOperation cop
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
  __pyx_v_cigar = __pyx_kp_s_14;

  /* "HTSeq/_HTSeq.pyx":1369
 *       cdef CigarOperation cop
 * 
 *       if self.aligned:             # <<<<<<<<<<<<<<
 *          query_start = self.iv
 *       else:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__aligned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":1370
 * 
 *       if self.aligned:
 *          query_start = self.iv             # <<<<<<<<<<<<<<
 *       else:
 *          query_start = GenomicPosition( "*", -1 )
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv));
    __pyx_v_query_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.__pyx_base.iv;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1372
 *          query_start = self.iv
 *       else:
 *          query_start = GenomicPosition( "*", -1 )             # <<<<<<<<<<<<<<
 * 
 *       if self.mate_start is not None:
 */
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_k_tuple_110), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_query_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "HTSeq/_HTSeq.pyx":1374
 *          query_start = GenomicPosition( "*", -1 )
 * 
 *       if self.mate_start is not None:             # <<<<<<<<<<<<<<
 *          mate_start = self.mate_start
 *       else:
 */
  __pyx_t_2 = (((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start) != Py_None);
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":1375
 * 
 *       if self.mate_start is not None:
 *          mate_start = self.mate_start             # <<<<<<<<<<<<<<
 *       else:
 *          mate_start = GenomicPosition( "*", -1 )
 */
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start));
    __pyx_v_mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1377
 *          mate_start = self.mate_start
 *       else:
 *          mate_start = GenomicPosition( "*", -1 )             # <<<<<<<<<<<<<<
 * 
 *       if self.cigar is not None:
 */
    __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition)), ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L6:;

  /* "HTSeq/_HTSeq.pyx":1379
 *          mate_start = GenomicPosition( "*", -1 )
 * 
 *       if self.cigar is not None:             # <<<<<<<<<<<<<<
 *          for cop in self.cigar:
 *             cigar += str(cop.size) + cop.type
 */
  __pyx_t_2 = (((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar != ((PyObject*)Py_None));
  if (__pyx_t_2) {

    /* "HTSeq/_HTSeq.pyx":1380
 * 
 *       if self.cigar is not None:
 *          for cop in self.cigar:             # <<<<<<<<<<<<<<
 *             cigar += str(cop.size) + cop.type
 *       else:
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5HTSeq_6_HTSeq_CigarOperation))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_cop));
      __pyx_v_cop = ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "HTSeq/_HTSeq.pyx":1381
 *       if self.cigar is not None:
 *          for cop in self.cigar:
 *             cigar += str(cop.size) + cop.type             # <<<<<<<<<<<<<<
 *       else:
 *          cigar = "*"
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_cop->size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __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 = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_v_cop->type)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_cigar), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_cigar));
      __pyx_v_cigar = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1383
 *             cigar += str(cop.size) + cop.type
 *       else:
 *          cigar = "*"             # <<<<<<<<<<<<<<
 * 
 *       return '\t'.join( ( self.read.name, str(self.flag), query_start.chrom,
 */
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_93));
    __Pyx_DECREF(((PyObject *)__pyx_v_cigar));
    __pyx_v_cigar = __pyx_kp_s_93;
  }
  __pyx_L7:;

  /* "HTSeq/_HTSeq.pyx":1385
 *          cigar = "*"
 * 
 *       return '\t'.join( ( self.read.name, str(self.flag), query_start.chrom,             # <<<<<<<<<<<<<<
 *           str(query_start.start+1), str(self.aQual), cigar, mate_start.chrom,
 *           str(mate_start.pos+1), str(self.inferred_insert_size),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_80), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__read); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__flag); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

  /* "HTSeq/_HTSeq.pyx":1386
 * 
 *       return '\t'.join( ( self.read.name, str(self.flag), query_start.chrom,
 *           str(query_start.start+1), str(self.aQual), cigar, mate_start.chrom,             # <<<<<<<<<<<<<<
 *           str(mate_start.pos+1), str(self.inferred_insert_size),
 *            self.read_as_aligned.seq, self.read_as_aligned.qualstr,
 */
  __pyx_t_6 = PyInt_FromLong((__pyx_v_query_start->start + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->aQual); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

  /* "HTSeq/_HTSeq.pyx":1387
 *       return '\t'.join( ( self.read.name, str(self.flag), query_start.chrom,
 *           str(query_start.start+1), str(self.aQual), cigar, mate_start.chrom,
 *           str(mate_start.pos+1), str(self.inferred_insert_size),             # <<<<<<<<<<<<<<
 *            self.read_as_aligned.seq, self.read_as_aligned.qualstr,
 *            '\t'.join( self.raw_optional_fields() ) ) )
 */
  __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_mate_start), __pyx_n_s__pos); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__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 = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->inferred_insert_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;

  /* "HTSeq/_HTSeq.pyx":1388
 *           str(query_start.start+1), str(self.aQual), cigar, mate_start.chrom,
 *           str(mate_start.pos+1), str(self.inferred_insert_size),
 *            self.read_as_aligned.seq, self.read_as_aligned.qualstr,             # <<<<<<<<<<<<<<
 *            '\t'.join( self.raw_optional_fields() ) ) )
 * 
 */
  __pyx_t_10 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.read_as_aligned), __pyx_n_s__qualstr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);

  /* "HTSeq/_HTSeq.pyx":1389
 *           str(mate_start.pos+1), str(self.inferred_insert_size),
 *            self.read_as_aligned.seq, self.read_as_aligned.qualstr,
 *            '\t'.join( self.raw_optional_fields() ) ) )             # <<<<<<<<<<<<<<
 * 
 *    def optional_field( SAM_Alignment self, str tag ):
 */
  __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_80), __pyx_n_s__join); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__raw_optional_fields); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __pyx_t_12 = PyTuple_New(12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_query_start->chrom));
  PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_query_start->chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_query_start->chrom));
  PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_cigar));
  PyTuple_SET_ITEM(__pyx_t_12, 5, ((PyObject *)__pyx_v_cigar));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_cigar));
  __Pyx_INCREF(((PyObject *)__pyx_v_mate_start->chrom));
  PyTuple_SET_ITEM(__pyx_t_12, 6, ((PyObject *)__pyx_v_mate_start->chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_mate_start->chrom));
  PyTuple_SET_ITEM(__pyx_t_12, 7, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_12, 8, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.read_as_aligned->__pyx_base.seq));
  PyTuple_SET_ITEM(__pyx_t_12, 9, ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.read_as_aligned->__pyx_base.seq));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->__pyx_base.read_as_aligned->__pyx_base.seq));
  PyTuple_SET_ITEM(__pyx_t_12, 10, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_12, 11, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_9 = 0;
  __pyx_t_8 = 0;
  __pyx_t_10 = 0;
  __pyx_t_13 = 0;
  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_12));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
  __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  __pyx_r = __pyx_t_12;
  __pyx_t_12 = 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.get_sam_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cigar);
  __Pyx_XDECREF((PyObject *)__pyx_v_query_start);
  __Pyx_XDECREF((PyObject *)__pyx_v_mate_start);
  __Pyx_XDECREF((PyObject *)__pyx_v_cop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1391
 *            '\t'.join( self.raw_optional_fields() ) ) )
 * 
 *    def optional_field( SAM_Alignment self, str tag ):             # <<<<<<<<<<<<<<
 *       res = [ p for p in self.optional_fields if p[0] == tag ]
 *       if len(res) == 1:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_6optional_field(PyObject *__pyx_v_self, PyObject *__pyx_v_tag); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_6optional_field(PyObject *__pyx_v_self, PyObject *__pyx_v_tag) {
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_p = 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 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("optional_field");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tag), (&PyString_Type), 1, "tag", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "HTSeq/_HTSeq.pyx":1392
 * 
 *    def optional_field( SAM_Alignment self, str tag ):
 *       res = [ p for p in self.optional_fields if p[0] == tag ]             # <<<<<<<<<<<<<<
 *       if len(res) == 1:
 *          return res[0][1]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    __Pyx_XDECREF(__pyx_v_p);
    __pyx_v_p = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_t_4, ((PyObject *)__pyx_v_tag), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {
      if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_v_p))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_v_res = __pyx_t_1;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1393
 *    def optional_field( SAM_Alignment self, str tag ):
 *       res = [ p for p in self.optional_fields if p[0] == tag ]
 *       if len(res) == 1:             # <<<<<<<<<<<<<<
 *          return res[0][1]
 *       else:
 */
  if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_res)); 
  __pyx_t_5 = (__pyx_t_3 == 1);
  if (__pyx_t_5) {

    /* "HTSeq/_HTSeq.pyx":1394
 *       res = [ p for p in self.optional_fields if p[0] == tag ]
 *       if len(res) == 1:
 *          return res[0][1]             # <<<<<<<<<<<<<<
 *       else:
 *          if len(res) == 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "HTSeq/_HTSeq.pyx":1396
 *          return res[0][1]
 *       else:
 *          if len(res) == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError, "SAM optional field tag %s not found" % tag
 *          else:
 */
    if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_res)); 
    __pyx_t_5 = (__pyx_t_3 == 0);
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":1397
 *       else:
 *          if len(res) == 0:
 *             raise KeyError, "SAM optional field tag %s not found" % tag             # <<<<<<<<<<<<<<
 *          else:
 *             raise ValueError, "SAM optional field tag %s not unique" % tag
 */
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_112), ((PyObject *)__pyx_v_tag)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_Raise(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_2), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L9;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1399
 *             raise KeyError, "SAM optional field tag %s not found" % tag
 *          else:
 *             raise ValueError, "SAM optional field tag %s not unique" % tag             # <<<<<<<<<<<<<<
 * 
 *    def raw_optional_fields( self ):
 */
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_113), ((PyObject *)__pyx_v_tag)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L9:;
  }
  __pyx_L8:;

  __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_4);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.optional_field", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pyx":1401
 *             raise ValueError, "SAM optional field tag %s not unique" % tag
 * 
 *    def raw_optional_fields( self ):             # <<<<<<<<<<<<<<
 *       res = []
 *       for op in self.optional_fields:
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_7raw_optional_fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_7raw_optional_fields(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_v_op = NULL;
  PyObject *__pyx_v_tc = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("raw_optional_fields");

  /* "HTSeq/_HTSeq.pyx":1402
 * 
 *    def raw_optional_fields( self ):
 *       res = []             # <<<<<<<<<<<<<<
 *       for op in self.optional_fields:
 *          if op[1].__class__ == str:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1403
 *    def raw_optional_fields( self ):
 *       res = []
 *       for op in self.optional_fields:             # <<<<<<<<<<<<<<
 *          if op[1].__class__ == str:
 *             if len(op[1]) == 1:
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_op);
    __pyx_v_op = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "HTSeq/_HTSeq.pyx":1404
 *       res = []
 *       for op in self.optional_fields:
 *          if op[1].__class__ == str:             # <<<<<<<<<<<<<<
 *             if len(op[1]) == 1:
 *                tc = "A"
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_op, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __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_RichCompare(__pyx_t_4, ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":1405
 *       for op in self.optional_fields:
 *          if op[1].__class__ == str:
 *             if len(op[1]) == 1:             # <<<<<<<<<<<<<<
 *                tc = "A"
 *             else:
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_op, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__pyx_t_6 == 1);
      if (__pyx_t_5) {

        /* "HTSeq/_HTSeq.pyx":1406
 *          if op[1].__class__ == str:
 *             if len(op[1]) == 1:
 *                tc = "A"             # <<<<<<<<<<<<<<
 *             else:
 *                tc = "Z"
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__A));
        __Pyx_XDECREF(__pyx_v_tc);
        __pyx_v_tc = ((PyObject *)__pyx_n_s__A);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "HTSeq/_HTSeq.pyx":1408
 *                tc = "A"
 *             else:
 *                tc = "Z"             # <<<<<<<<<<<<<<
 *          elif op[1].__class__ == int:
 *             tc = "i"
 */
        __Pyx_INCREF(((PyObject *)__pyx_n_s__Z));
        __Pyx_XDECREF(__pyx_v_tc);
        __pyx_v_tc = ((PyObject *)__pyx_n_s__Z);
      }
      __pyx_L8:;
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1409
 *             else:
 *                tc = "Z"
 *          elif op[1].__class__ == int:             # <<<<<<<<<<<<<<
 *             tc = "i"
 *          elif op[1].__class__ == float:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_op, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __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_RichCompare(__pyx_t_4, ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":1410
 *                tc = "Z"
 *          elif op[1].__class__ == int:
 *             tc = "i"             # <<<<<<<<<<<<<<
 *          elif op[1].__class__ == float:
 *             tc = "j"
 */
      __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
      __Pyx_XDECREF(__pyx_v_tc);
      __pyx_v_tc = ((PyObject *)__pyx_n_s__i);
      goto __pyx_L7;
    }

    /* "HTSeq/_HTSeq.pyx":1411
 *          elif op[1].__class__ == int:
 *             tc = "i"
 *          elif op[1].__class__ == float:             # <<<<<<<<<<<<<<
 *             tc = "j"
 *          else:
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_op, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __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_RichCompare(__pyx_t_4, ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "HTSeq/_HTSeq.pyx":1412
 *             tc = "i"
 *          elif op[1].__class__ == float:
 *             tc = "j"             # <<<<<<<<<<<<<<
 *          else:
 *             tc = "H"
 */
      __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
      __Pyx_XDECREF(__pyx_v_tc);
      __pyx_v_tc = ((PyObject *)__pyx_n_s__j);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "HTSeq/_HTSeq.pyx":1414
 *             tc = "j"
 *          else:
 *             tc = "H"             # <<<<<<<<<<<<<<
 *          res.append( ":".join( [ op[0], tc, str(op[1]) ] ) )
 *       return res
 */
      __Pyx_INCREF(((PyObject *)__pyx_n_s__H));
      __Pyx_XDECREF(__pyx_v_tc);
      __pyx_v_tc = ((PyObject *)__pyx_n_s__H);
    }
    __pyx_L7:;

    /* "HTSeq/_HTSeq.pyx":1415
 *          else:
 *             tc = "H"
 *          res.append( ":".join( [ op[0], tc, str(op[1]) ] ) )             # <<<<<<<<<<<<<<
 *       return res
 */
    if (unlikely(((PyObject *)__pyx_v_res) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_87), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_op, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_op, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_t_8 = PyList_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_tc);
    PyList_SET_ITEM(__pyx_t_8, 1, __pyx_v_tc);
    __Pyx_GIVEREF(__pyx_v_tc);
    PyList_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_4 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_9 = PyList_Append(__pyx_v_res, __pyx_t_8); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":1416
 *             tc = "H"
 *          res.append( ":".join( [ op[0], tc, str(op[1]) ] ) )
 *       return res             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.raw_optional_fields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_XDECREF(__pyx_v_tc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":51
 * 
 * cdef class SAM_Alignment( AlignmentWithSequenceReversal ):
 *    cdef public list cigar             # <<<<<<<<<<<<<<
 *    cdef public int aQual
 *    cdef public GenomicPosition mate_start
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.cigar.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->cigar = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":52
 * cdef class SAM_Alignment( AlignmentWithSequenceReversal ):
 *    cdef public list cigar
 *    cdef public int aQual             # <<<<<<<<<<<<<<
 *    cdef public GenomicPosition mate_start
 *    cdef public str pe_which
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->aQual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __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("HTSeq._HTSeq.SAM_Alignment.aQual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->aQual = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.aQual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":53
 *    cdef public list cigar
 *    cdef public int aQual
 *    cdef public GenomicPosition mate_start             # <<<<<<<<<<<<<<
 *    cdef public str pe_which
 *    cdef public int inferred_insert_size
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.mate_start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":54
 *    cdef public int aQual
 *    cdef public GenomicPosition mate_start
 *    cdef public str pe_which             # <<<<<<<<<<<<<<
 *    cdef public int inferred_insert_size
 *    cdef public bint proper_pair
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.pe_which.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pe_which = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":55
 *    cdef public GenomicPosition mate_start
 *    cdef public str pe_which
 *    cdef public int inferred_insert_size             # <<<<<<<<<<<<<<
 *    cdef public bint proper_pair
 *    cdef public bint not_primary_alignment
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->inferred_insert_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __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("HTSeq._HTSeq.SAM_Alignment.inferred_insert_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->inferred_insert_size = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.inferred_insert_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":56
 *    cdef public str pe_which
 *    cdef public int inferred_insert_size
 *    cdef public bint proper_pair             # <<<<<<<<<<<<<<
 *    cdef public bint not_primary_alignment
 *    cdef public bint failed_platform_qc
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->proper_pair); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __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("HTSeq._HTSeq.SAM_Alignment.proper_pair.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->proper_pair = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.proper_pair.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":57
 *    cdef public int inferred_insert_size
 *    cdef public bint proper_pair
 *    cdef public bint not_primary_alignment             # <<<<<<<<<<<<<<
 *    cdef public bint failed_platform_qc
 *    cdef public bint pcr_or_optical_duplicate
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->not_primary_alignment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __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("HTSeq._HTSeq.SAM_Alignment.not_primary_alignment.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->not_primary_alignment = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.not_primary_alignment.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":58
 *    cdef public bint proper_pair
 *    cdef public bint not_primary_alignment
 *    cdef public bint failed_platform_qc             # <<<<<<<<<<<<<<
 *    cdef public bint pcr_or_optical_duplicate
 *    cdef readonly str original_sam_line
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->failed_platform_qc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __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("HTSeq._HTSeq.SAM_Alignment.failed_platform_qc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->failed_platform_qc = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.failed_platform_qc.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":59
 *    cdef public bint not_primary_alignment
 *    cdef public bint failed_platform_qc
 *    cdef public bint pcr_or_optical_duplicate             # <<<<<<<<<<<<<<
 *    cdef readonly str original_sam_line
 *    cdef int _flag
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate___get__(PyObject *__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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pcr_or_optical_duplicate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __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("HTSeq._HTSeq.SAM_Alignment.pcr_or_optical_duplicate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->pcr_or_optical_duplicate = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.pcr_or_optical_duplicate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "HTSeq/_HTSeq.pxd":60
 *    cdef public bint failed_platform_qc
 *    cdef public bint pcr_or_optical_duplicate
 *    cdef readonly str original_sam_line             # <<<<<<<<<<<<<<
 *    cdef int _flag
 *    cdef public list optional_fields
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_17original_sam_line___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_17original_sam_line___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->original_sam_line));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->original_sam_line);
  goto __pyx_L0;

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

/* "HTSeq/_HTSeq.pxd":62
 *    cdef readonly str original_sam_line
 *    cdef int _flag
 *    cdef public list optional_fields             # <<<<<<<<<<<<<<
 * 
 */

static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields);
  goto __pyx_L0;

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

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("HTSeq._HTSeq.SAM_Alignment.optional_fields.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields));
  ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)__pyx_v_self)->optional_fields = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":190
 *         # 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 CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__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__");
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":196
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":199
 * 
 *             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":200
 *             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":202
 *             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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":204
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":205
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "numpy.pxd":207
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L6:;

  /* "numpy.pxd":209
 *                 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);
  if (__pyx_t_1) {

    /* "numpy.pxd":210
 * 
 *             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(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":211
 *             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_115), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __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[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "numpy.pxd":213
 *                 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);
  if (__pyx_t_3) {

    /* "numpy.pxd":214
 * 
 *             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(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":215
 *             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_117), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __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[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "numpy.pxd":217
 *                 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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":218
 * 
 *             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":219
 *             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.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":222
 *                 # 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":223
 *                 # 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":224
 *                 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":225
 *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);

      /* "numpy.pxd":226
 *                 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(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
    }
    goto __pyx_L9;
  }
  /*else*/ {

    /* "numpy.pxd":228
 *                     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(((PyArrayObject *)__pyx_v_self)));

    /* "numpy.pxd":229
 *             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(((PyArrayObject *)__pyx_v_self)));
  }
  __pyx_L9:;

  /* "numpy.pxd":230
 *                 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":231
 *                 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(((PyArrayObject *)__pyx_v_self));

  /* "numpy.pxd":232
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));

  /* "numpy.pxd":235
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":236
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;

  /* "numpy.pxd":240
 *             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":242
 *             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);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":244
 *             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_L12;
  }
  /*else*/ {

    /* "numpy.pxd":247
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = __pyx_v_self;
  }
  __pyx_L12:;

  /* "numpy.pxd":249
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":250
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_v_t = __pyx_v_descr->type_num;

    /* "numpy.pxd":251
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":252
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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 == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __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":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_119), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __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[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "numpy.pxd":254
 *                     (descr.byteorder == '<' 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L15;
    }

    /* "numpy.pxd":255
 *                     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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L15;
    }

    /* "numpy.pxd":256
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L15;
    }

    /* "numpy.pxd":257
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L15;
    }

    /* "numpy.pxd":258
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L15;
    }

    /* "numpy.pxd":259
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L15;
    }

    /* "numpy.pxd":260
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L15;
    }

    /* "numpy.pxd":261
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L15;
    }

    /* "numpy.pxd":262
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":263
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L15;
    }

    /* "numpy.pxd":264
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L15;
    }

    /* "numpy.pxd":265
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L15;
    }

    /* "numpy.pxd":266
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L15;
    }

    /* "numpy.pxd":267
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L15;
    }

    /* "numpy.pxd":268
 *                 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"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L15;
    }

    /* "numpy.pxd":269
 *                 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:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L15;
    }

    /* "numpy.pxd":270
 *                 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)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "numpy.pxd":272
 *                 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[2]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_120), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 272; __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[2]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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[2]; __pyx_lineno = 272; __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[2]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L15:;

    /* "numpy.pxd":273
 *                 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":274
 *                     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_L13;
  }
  /*else*/ {

    /* "numpy.pxd":276
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":277
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":278
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # 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":281
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_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[2]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":282
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L13:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("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;
}

/* "numpy.pxd":284
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__");

  /* "numpy.pxd":285
 * 
 *         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(((PyArrayObject *)__pyx_v_self));
  if (__pyx_t_1) {

    /* "numpy.pxd":286
 *         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_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":287
 *             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)));
  if (__pyx_t_1) {

    /* "numpy.pxd":288
 *                 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_L6;
  }
  __pyx_L6:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":764
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_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");

  /* "numpy.pxd":765
 * 
 * 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[2]; __pyx_lineno = 765; __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("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":767
 *     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_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");

  /* "numpy.pxd":768
 * 
 * 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[2]; __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("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":770
 *     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_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");

  /* "numpy.pxd":771
 * 
 * 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[2]; __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("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":773
 *     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_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");

  /* "numpy.pxd":774
 * 
 * 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[2]; __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("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":776
 *     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_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");

  /* "numpy.pxd":777
 * 
 * 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[2]; __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("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":779
 *     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_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;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring");

  /* "numpy.pxd":786
 *     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":787
 *     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":790
 *     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[2]; __pyx_lineno = 790; __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;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++;
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":791
 * 
 *     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[2]; __pyx_lineno = 791; __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[2]; __pyx_lineno = 791; __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":792
 *     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 (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 792; __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":794
 *         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[2]; __pyx_lineno = 794; __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[2]; __pyx_lineno = 794; __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[2]; __pyx_lineno = 794; __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[2]; __pyx_lineno = 794; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {

      /* "numpy.pxd":795
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_122), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __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[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "numpy.pxd":797
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_6 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_6) {
      __pyx_t_7 = __pyx_v_little_endian;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (!__pyx_t_7) {

      /* "numpy.pxd":798
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_6 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_6) {
        __pyx_t_8 = (!__pyx_v_little_endian);
        __pyx_t_9 = __pyx_t_8;
      } else {
        __pyx_t_9 = __pyx_t_6;
      }
      __pyx_t_6 = __pyx_t_9;
    } else {
      __pyx_t_6 = __pyx_t_7;
    }
    if (__pyx_t_6) {

      /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_123), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __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[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "numpy.pxd":809
 * 
 *         # 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[2]; __pyx_lineno = 809; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_6) break;

      /* "numpy.pxd":810
 *         # 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":811
 *         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":812
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_10 = 0;
      (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
    }

    /* "numpy.pxd":814
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_10 = 0;
    (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);

    /* "numpy.pxd":816
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_6) {

      /* "numpy.pxd":817
 * 
 *         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[2]; __pyx_lineno = 817; __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":818
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_6) {

        /* "numpy.pxd":819
 *             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_125), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 819; __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[2]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "numpy.pxd":822
 * 
 *             # 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[2]; __pyx_lineno = 822; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L11;
      }

      /* "numpy.pxd":823
 *             # 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[2]; __pyx_lineno = 823; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L11;
      }

      /* "numpy.pxd":824
 *             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[2]; __pyx_lineno = 824; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L11;
      }

      /* "numpy.pxd":825
 *             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[2]; __pyx_lineno = 825; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L11;
      }

      /* "numpy.pxd":826
 *             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[2]; __pyx_lineno = 826; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L11;
      }

      /* "numpy.pxd":827
 *             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[2]; __pyx_lineno = 827; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L11;
      }

      /* "numpy.pxd":828
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L11;
      }

      /* "numpy.pxd":829
 *             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[2]; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L11;
      }

      /* "numpy.pxd":830
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L11;
      }

      /* "numpy.pxd":831
 *             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[2]; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L11;
      }

      /* "numpy.pxd":832
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L11;
      }

      /* "numpy.pxd":833
 *             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[2]; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L11;
      }

      /* "numpy.pxd":834
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L11;
      }

      /* "numpy.pxd":835
 *             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[2]; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":836
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":837
 *             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[2]; __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L11;
      }

      /* "numpy.pxd":838
 *             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[2]; __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "numpy.pxd":840
 *             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_120), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __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[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__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[2]; __pyx_lineno = 840; __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[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L11:;

      /* "numpy.pxd":841
 *             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_L9;
    }
    /*else*/ {

      /* "numpy.pxd":845
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_11;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":846
 *             # 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("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":961
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base");

  /* "numpy.pxd":963
 * 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);
  if (__pyx_t_1) {

    /* "numpy.pxd":964
 *      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":966
 *          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":967
 *      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":968
 *          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":969
 *          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":971
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base");

  /* "numpy.pxd":972
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":973
 * 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":975
 *         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 struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval __pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval;

static PyObject *__pyx_tp_new_5HTSeq_6_HTSeq_GenomicInterval(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)o);
  p->__pyx_vtab = __pyx_vtabptr_5HTSeq_6_HTSeq_GenomicInterval;
  p->chrom = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_strand = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_GenomicInterval(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)o;
  Py_XDECREF(((PyObject *)p->chrom));
  Py_XDECREF(((PyObject *)p->_strand));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_GenomicInterval(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)o;
  if (p->chrom) {
    e = (*v)(p->chrom, a); if (e) return e;
  }
  if (p->_strand) {
    e = (*v)(p->_strand, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_GenomicInterval(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->chrom);
  p->chrom = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_strand);
  p->_strand = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_strand(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand_1__get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_strand(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6strand___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_length(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_length(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6length_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7start_d_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_d(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5end_d___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_as_pos(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12start_as_pos___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_as_pos(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10end_as_pos___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d_as_pos(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_14start_d_as_pos___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_d_as_pos(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12end_d_as_pos___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_chrom(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_chrom(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5chrom_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_start(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5start_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_end(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3end_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_GenomicInterval[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_1__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_2__copy__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("is_contained_in"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in, METH_O, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_7is_contained_in)},
  {__Pyx_NAMESTR("contains"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_8contains, METH_O, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_8contains)},
  {__Pyx_NAMESTR("overlaps"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps, METH_O, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_9overlaps)},
  {__Pyx_NAMESTR("xrange"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_10xrange, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_10xrange)},
  {__Pyx_NAMESTR("xrange_d"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_11xrange_d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_11xrange_d)},
  {__Pyx_NAMESTR("extend_to_include"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include, METH_O, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval_12extend_to_include)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_13copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_GenomicInterval[] = {
  {(char *)"strand", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_strand, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_strand, 0, 0},
  {(char *)"length", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_length, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_length, __Pyx_DOCSTR(__pyx_k_126), 0},
  {(char *)"start_d", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d, __Pyx_DOCSTR(__pyx_k_127), 0},
  {(char *)"end_d", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_d, 0, 0, 0},
  {(char *)"start_as_pos", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_as_pos, 0, 0, 0},
  {(char *)"end_as_pos", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_as_pos, 0, 0, 0},
  {(char *)"start_d_as_pos", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start_d_as_pos, 0, 0, 0},
  {(char *)"end_d_as_pos", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end_d_as_pos, 0, 0, 0},
  {(char *)"chrom", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_chrom, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_chrom, 0, 0},
  {(char *)"start", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_start, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_start, 0, 0},
  {(char *)"end", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicInterval_end, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicInterval_end, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GenomicInterval = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GenomicInterval = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_GenomicInterval = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GenomicInterval = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_GenomicInterval = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.GenomicInterval"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_GenomicInterval, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number_GenomicInterval, /*tp_as_number*/
  &__pyx_tp_as_sequence_GenomicInterval, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GenomicInterval, /*tp_as_mapping*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_6__hash__, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_4__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GenomicInterval, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A GenomicInterval specifies an interval (i.e., a range of \n   consecutive positions) on a reference genome.\n   \n   A GenomicInterval object has the following slots, some of which \n   are calculated from the other:\n     \n      chrom: The name of a sequence (i.e., chromosome, contig, or \n         the like). \n      start: The start of the interval. Even on the reverse strand,\n         this is always the smaller of the two values 'start' and 'end'.\n         Note that all positions should be given as 0-based value!\n      end: The end of the interval. Following Python convention for \n         ranges, this in one more than the coordinate of the last base\n         that is considered part of the sequence.\n      strand: The strand, as a single character, '+' or '-'. '.' indicates\n         that the strand is irrelavant. (Alternatively, pass a Strand object.)\n      length: The length of the interval, i.e., end - start\n      start_d: The \"directional start\" position. This is the position of the\n        first base of the interval, taking the strand into account. Hence, \n        this is the same as 'start' except when strand == '-', in which \n        case it is end-1.\n      end_d: The \"directional end\": Usually, the same as 'end', but for \n        strand=='-1', it is start-1.\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_GenomicInterval, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_GenomicInterval, /*tp_clear*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval_5__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_GenomicInterval, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_GenomicInterval, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicInterval___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_GenomicInterval, /*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_5HTSeq_6_HTSeq_GenomicPosition __pyx_vtable_5HTSeq_6_HTSeq_GenomicPosition;

static PyObject *__pyx_tp_new_5HTSeq_6_HTSeq_GenomicPosition(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *p;
  PyObject *o = __pyx_tp_new_5HTSeq_6_HTSeq_GenomicInterval(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5HTSeq_6_HTSeq_GenomicInterval*)__pyx_vtabptr_5HTSeq_6_HTSeq_GenomicPosition;
  return o;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_pos(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15GenomicPosition_pos(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3pos_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_end(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3end___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_length(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_6length___get__(o);
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_GenomicPosition[] = {
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_4copy, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_GenomicPosition[] = {
  {(char *)"pos", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_pos, __pyx_setprop_5HTSeq_6_HTSeq_15GenomicPosition_pos, __Pyx_DOCSTR(__pyx_k_128), 0},
  {(char *)"end", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_end, 0, 0, 0},
  {(char *)"length", __pyx_getprop_5HTSeq_6_HTSeq_15GenomicPosition_length, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GenomicPosition = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GenomicPosition = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_GenomicPosition = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GenomicPosition = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_GenomicPosition = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.GenomicPosition"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_GenomicInterval, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_GenomicPosition, /*tp_as_number*/
  &__pyx_tp_as_sequence_GenomicPosition, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GenomicPosition, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition_2__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GenomicPosition, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A GenomicPosition specifies the position of a nucleotide or\n   base pair on a reference genome.\n   \n   It has the following slots:\n      chrom: The name of a sequence (i.e., chromosome, contig, or \n         the like). \n      pos: The position on the sequence specified by seqname.\n         The position should always be given as 0-based value!\n      strand: The strand, as a single character, '+' or '-'. '.' indicates\n         that the strand is irrelavant.\n\n   The GenomicPosition class is derived from GenomicInterval. Hence,\n   a GenomicPosition is always a GenomicInterval of length 1. Do not tinker\n   with the exposed GenomeInterval slots.\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_GenomicInterval, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_GenomicInterval, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_GenomicPosition, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_GenomicPosition, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_15GenomicPosition___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_GenomicPosition, /*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_5HTSeq_6_HTSeq_Sequence __pyx_vtable_5HTSeq_6_HTSeq_Sequence;

static PyObject *__pyx_tp_new_5HTSeq_6_HTSeq_Sequence(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)o);
  p->__pyx_vtab = __pyx_vtabptr_5HTSeq_6_HTSeq_Sequence;
  p->seq = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->descr = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_Sequence(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)o;
  Py_XDECREF(((PyObject *)p->seq));
  Py_XDECREF(((PyObject *)p->name));
  Py_XDECREF(((PyObject *)p->descr));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_Sequence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)o;
  if (p->seq) {
    e = (*v)(p->seq, a); if (e) return e;
  }
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->descr) {
    e = (*v)(p->descr, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_Sequence(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->seq);
  p->seq = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->name);
  p->name = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->descr);
  p->descr = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5HTSeq_6_HTSeq_Sequence(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_8Sequence_seq(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_seq(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3seq_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_8Sequence_name(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_name(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4name_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_8Sequence_descr(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_descr(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5descr_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_Sequence[] = {
  {__Pyx_NAMESTR("get_reverse_complement"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8Sequence_1get_reverse_complement, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("write_to_fasta_file"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8Sequence_6write_to_fasta_file, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_bases_to_count_array"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8Sequence_7add_bases_to_count_array, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("trim_left_end"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8Sequence_8trim_left_end, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("trim_right_end"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_8Sequence_9trim_right_end, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_Sequence[] = {
  {(char *)"seq", __pyx_getprop_5HTSeq_6_HTSeq_8Sequence_seq, __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_seq, 0, 0},
  {(char *)"name", __pyx_getprop_5HTSeq_6_HTSeq_8Sequence_name, __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_name, 0, 0},
  {(char *)"descr", __pyx_getprop_5HTSeq_6_HTSeq_8Sequence_descr, __pyx_setprop_5HTSeq_6_HTSeq_8Sequence_descr, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Sequence = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Sequence = {
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5HTSeq_6_HTSeq_Sequence, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Sequence = {
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence_4__len__, /*mp_length*/
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Sequence = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_Sequence = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.Sequence"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_Sequence, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence_3__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Sequence, /*tp_as_number*/
  &__pyx_tp_as_sequence_Sequence, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Sequence, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence_2__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Sequence, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A Sequence, typically of DNA, with a name.\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_Sequence, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_Sequence, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_Sequence, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_Sequence, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_8Sequence___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_Sequence, /*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_5HTSeq_6_HTSeq_SequenceWithQualities __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities;

static PyObject *__pyx_tp_new_5HTSeq_6_HTSeq_SequenceWithQualities(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *p;
  PyObject *o = __pyx_tp_new_5HTSeq_6_HTSeq_Sequence(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5HTSeq_6_HTSeq_Sequence*)__pyx_vtabptr_5HTSeq_6_HTSeq_SequenceWithQualities;
  p->_qualstr = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_qualstr_phred = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_qualscale = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_qualarr = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_SequenceWithQualities(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)o;
  Py_XDECREF(((PyObject *)p->_qualstr));
  Py_XDECREF(((PyObject *)p->_qualstr_phred));
  Py_XDECREF(((PyObject *)p->_qualscale));
  Py_XDECREF(p->_qualarr);
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_Sequence(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_SequenceWithQualities(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)o;
  e = __pyx_tp_traverse_5HTSeq_6_HTSeq_Sequence(o, v, a); if (e) return e;
  if (p->_qualstr) {
    e = (*v)(p->_qualstr, a); if (e) return e;
  }
  if (p->_qualstr_phred) {
    e = (*v)(p->_qualstr_phred, a); if (e) return e;
  }
  if (p->_qualscale) {
    e = (*v)(p->_qualscale, a); if (e) return e;
  }
  if (p->_qualarr) {
    e = (*v)(p->_qualarr, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_SequenceWithQualities(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)o;
  PyObject* tmp;
  __pyx_tp_clear_5HTSeq_6_HTSeq_Sequence(o);
  tmp = ((PyObject*)p->_qualstr);
  p->_qualstr = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_qualstr_phred);
  p->_qualstr_phred = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_qualscale);
  p->_qualscale = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_qualarr);
  p->_qualarr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5HTSeq_6_HTSeq_SequenceWithQualities(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities_qual(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_21SequenceWithQualities_qual(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4qual_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualstr(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualstr___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualstr_phred(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_14_qualstr_phred___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualscale(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_10_qualscale___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualarr(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8_qualarr___get__(o);
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_SequenceWithQualities[] = {
  {__Pyx_NAMESTR("qualstr"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_3qualstr, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("write_to_fastq_file"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_4write_to_fastq_file, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_fastq_str"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_5get_fastq_str, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_reverse_complement"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_6get_reverse_complement, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("add_qual_to_count_array"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_7add_qual_to_count_array, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("trim_left_end_with_quals"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_8trim_left_end_with_quals, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("trim_right_end_with_quals"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_9trim_right_end_with_quals, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_SequenceWithQualities[] = {
  {(char *)"qual", __pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities_qual, __pyx_setprop_5HTSeq_6_HTSeq_21SequenceWithQualities_qual, 0, 0},
  {(char *)"_qualstr", __pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualstr, 0, 0, 0},
  {(char *)"_qualstr_phred", __pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualstr_phred, 0, 0, 0},
  {(char *)"_qualscale", __pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualscale, 0, 0, 0},
  {(char *)"_qualarr", __pyx_getprop_5HTSeq_6_HTSeq_21SequenceWithQualities__qualarr, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SequenceWithQualities = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SequenceWithQualities = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5HTSeq_6_HTSeq_SequenceWithQualities, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SequenceWithQualities = {
  0, /*mp_length*/
  __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_2__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SequenceWithQualities = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.SequenceWithQualities"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_SequenceWithQualities, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_SequenceWithQualities, /*tp_as_number*/
  &__pyx_tp_as_sequence_SequenceWithQualities, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SequenceWithQualities, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SequenceWithQualities, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A Sequence with base-call quality scores.\n   It now has property  'qual', an integer NumPy array of Sanger/Phred \n   quality scores of the  base calls.\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_SequenceWithQualities, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_SequenceWithQualities, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_SequenceWithQualities, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_SequenceWithQualities, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_21SequenceWithQualities___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_SequenceWithQualities, /*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_5HTSeq_6_HTSeq_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)o);
  p->_read = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  p->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_Alignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)o;
  Py_XDECREF(((PyObject *)p->_read));
  Py_XDECREF(((PyObject *)p->iv));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_Alignment(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)o;
  if (p->_read) {
    e = (*v)(((PyObject*)p->_read), a); if (e) return e;
  }
  if (p->iv) {
    e = (*v)(((PyObject*)p->iv), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_Alignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_Alignment *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->_read);
  p->_read = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->iv);
  p->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_9Alignment__read(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_9Alignment__read(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_5_read_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_9Alignment_iv(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_9Alignment_iv(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2iv_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_Alignment[] = {
  {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_9Alignment_1read, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("paired_end"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_9Alignment_3paired_end, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("aligned"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_9Alignment_4aligned, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_9Alignment_4aligned)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_Alignment[] = {
  {(char *)"_read", __pyx_getprop_5HTSeq_6_HTSeq_9Alignment__read, __pyx_setprop_5HTSeq_6_HTSeq_9Alignment__read, 0, 0},
  {(char *)"iv", __pyx_getprop_5HTSeq_6_HTSeq_9Alignment_iv, __pyx_setprop_5HTSeq_6_HTSeq_9Alignment_iv, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Alignment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Alignment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Alignment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Alignment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_Alignment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.Alignment"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_Alignment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_Alignment, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_9Alignment_2__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Alignment, /*tp_as_number*/
  &__pyx_tp_as_sequence_Alignment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Alignment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Alignment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Alignment base type:\n\n   An alignment object can be defined in different ways but will always\n   provide these attributes:\n     read:      a SequenceWithQualities object with the read\n     aligned:   whether the read is aligned\n     iv:        a GenomicInterval object with the alignment position \n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_Alignment, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_Alignment, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_Alignment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_Alignment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_9Alignment___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_Alignment, /*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_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *p;
  PyObject *o = __pyx_tp_new_5HTSeq_6_HTSeq_Alignment(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)o);
  p->read_as_aligned = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  p->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *p = (struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)o;
  Py_XDECREF(((PyObject *)p->read_as_aligned));
  Py_XDECREF(((PyObject *)p->_read_as_sequenced));
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_Alignment(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *p = (struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)o;
  e = __pyx_tp_traverse_5HTSeq_6_HTSeq_Alignment(o, v, a); if (e) return e;
  if (p->read_as_aligned) {
    e = (*v)(((PyObject*)p->read_as_aligned), a); if (e) return e;
  }
  if (p->_read_as_sequenced) {
    e = (*v)(((PyObject*)p->_read_as_sequenced), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *p = (struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal *)o;
  PyObject* tmp;
  __pyx_tp_clear_5HTSeq_6_HTSeq_Alignment(o);
  tmp = ((PyObject*)p->read_as_aligned);
  p->read_as_aligned = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_read_as_sequenced);
  p->_read_as_sequenced = ((struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_4read___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read_as_aligned(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read_as_aligned(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_15read_as_aligned_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal__read_as_sequenced(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal__read_as_sequenced(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_18_read_as_sequenced_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal[] = {
  {(char *)"read", __pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read, 0, 0, 0},
  {(char *)"read_as_aligned", __pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read_as_aligned, __pyx_setprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal_read_as_aligned, 0, 0},
  {(char *)"_read_as_sequenced", __pyx_getprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal__read_as_sequenced, __pyx_setprop_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal__read_as_sequenced, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_AlignmentWithSequenceReversal = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_AlignmentWithSequenceReversal = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_AlignmentWithSequenceReversal = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_AlignmentWithSequenceReversal = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.AlignmentWithSequenceReversal"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*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*/
  &__pyx_tp_as_number_AlignmentWithSequenceReversal, /*tp_as_number*/
  &__pyx_tp_as_sequence_AlignmentWithSequenceReversal, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_AlignmentWithSequenceReversal, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_AlignmentWithSequenceReversal, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("Many aligners report the read's sequence in reverse-complemented form\n   when it was mapped to the reverse strand. For such alignments, a \n   daughter class of this one should be used.\n   \n   Then, the read is stored as aligned in the 'read_as_aligned' field,\n   and get reverse-complemented back to the sequenced form when the 'read'\n   attribute is sequenced.\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_29AlignmentWithSequenceReversal___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal, /*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_5HTSeq_6_HTSeq_SAM_Alignment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *p;
  PyObject *o = __pyx_tp_new_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)o);
  p->cigar = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)Py_None); Py_INCREF(Py_None);
  p->pe_which = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->original_sam_line = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->optional_fields = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_SAM_Alignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)o;
  Py_XDECREF(((PyObject *)p->cigar));
  Py_XDECREF(((PyObject *)p->mate_start));
  Py_XDECREF(((PyObject *)p->pe_which));
  Py_XDECREF(((PyObject *)p->original_sam_line));
  Py_XDECREF(((PyObject *)p->optional_fields));
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_SAM_Alignment(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)o;
  e = __pyx_tp_traverse_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o, v, a); if (e) return e;
  if (p->cigar) {
    e = (*v)(p->cigar, a); if (e) return e;
  }
  if (p->mate_start) {
    e = (*v)(((PyObject*)p->mate_start), a); if (e) return e;
  }
  if (p->pe_which) {
    e = (*v)(p->pe_which, a); if (e) return e;
  }
  if (p->original_sam_line) {
    e = (*v)(p->original_sam_line, a); if (e) return e;
  }
  if (p->optional_fields) {
    e = (*v)(p->optional_fields, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_SAM_Alignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment *)o;
  PyObject* tmp;
  __pyx_tp_clear_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o);
  tmp = ((PyObject*)p->cigar);
  p->cigar = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mate_start);
  p->mate_start = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicPosition *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pe_which);
  p->pe_which = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->original_sam_line);
  p->original_sam_line = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->optional_fields);
  p->optional_fields = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_flag(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_flag(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4flag_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_cigar(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_cigar(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5cigar_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_aQual(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_aQual(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5aQual_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_mate_start(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_mate_start(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_10mate_start_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_pe_which(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_pe_which(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_8pe_which_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_inferred_insert_size(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_inferred_insert_size(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_20inferred_insert_size_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_proper_pair(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_proper_pair(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_11proper_pair_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_not_primary_alignment(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_not_primary_alignment(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_21not_primary_alignment_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_failed_platform_qc(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_failed_platform_qc(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_18failed_platform_qc_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_pcr_or_optical_duplicate(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_pcr_or_optical_duplicate(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_24pcr_or_optical_duplicate_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_original_sam_line(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_17original_sam_line___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_optional_fields(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_optional_fields(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_15optional_fields_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_SAM_Alignment[] = {
  {__Pyx_NAMESTR("to_pysam_AlignedRead"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_to_pysam_AlignedRead, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("from_pysam_AlignedRead"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_1from_pysam_AlignedRead, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("from_SAM_line"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_2from_SAM_line, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("paired_end"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_3paired_end, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("mate_aligned"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_4mate_aligned, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_sam_line"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_5get_sam_line, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("optional_field"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_6optional_field, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("raw_optional_fields"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_13SAM_Alignment_7raw_optional_fields, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_SAM_Alignment[] = {
  {(char *)"flag", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_flag, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_flag, 0, 0},
  {(char *)"cigar", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_cigar, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_cigar, 0, 0},
  {(char *)"aQual", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_aQual, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_aQual, 0, 0},
  {(char *)"mate_start", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_mate_start, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_mate_start, 0, 0},
  {(char *)"pe_which", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_pe_which, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_pe_which, 0, 0},
  {(char *)"inferred_insert_size", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_inferred_insert_size, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_inferred_insert_size, 0, 0},
  {(char *)"proper_pair", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_proper_pair, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_proper_pair, 0, 0},
  {(char *)"not_primary_alignment", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_not_primary_alignment, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_not_primary_alignment, 0, 0},
  {(char *)"failed_platform_qc", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_failed_platform_qc, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_failed_platform_qc, 0, 0},
  {(char *)"pcr_or_optical_duplicate", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_pcr_or_optical_duplicate, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_pcr_or_optical_duplicate, 0, 0},
  {(char *)"original_sam_line", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_original_sam_line, 0, 0, 0},
  {(char *)"optional_fields", __pyx_getprop_5HTSeq_6_HTSeq_13SAM_Alignment_optional_fields, __pyx_setprop_5HTSeq_6_HTSeq_13SAM_Alignment_optional_fields, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SAM_Alignment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_SAM_Alignment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_SAM_Alignment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SAM_Alignment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_SAM_Alignment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.SAM_Alignment"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_SAM_Alignment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_SAM_Alignment, /*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*/
  &__pyx_tp_as_number_SAM_Alignment, /*tp_as_number*/
  &__pyx_tp_as_sequence_SAM_Alignment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SAM_Alignment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SAM_Alignment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("When reading in a SAM file, objects of the class SAM_Alignment\n   are returned. In addition to the 'read', 'iv' and 'aligned' fields (see \n   Alignment class), the following fields are provided:\n    - aQual: the alignment quality score\n    - cigar: a list of CigarOperatio objects, describing the alignment\n    - tags: the extra information tags [not yet implemented]\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_SAM_Alignment, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_SAM_Alignment, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_SAM_Alignment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_SAM_Alignment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_SAM_Alignment, /*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_5HTSeq_6_HTSeq_ChromVector(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)o);
  p->array = Py_None; Py_INCREF(Py_None);
  p->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_ChromVector(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *p = (struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)o;
  Py_XDECREF(p->array);
  Py_XDECREF(((PyObject *)p->iv));
  Py_XDECREF(((PyObject *)p->_storage));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_ChromVector(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *p = (struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)o;
  if (p->array) {
    e = (*v)(p->array, a); if (e) return e;
  }
  if (p->iv) {
    e = (*v)(((PyObject*)p->iv), a); if (e) return e;
  }
  if (p->_storage) {
    e = (*v)(p->_storage, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_ChromVector(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *p = (struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->array);
  p->array = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->iv);
  p->iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_storage);
  p->_storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5HTSeq_6_HTSeq_ChromVector(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_5HTSeq_6_HTSeq_ChromVector(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_3__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_array(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_array(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5array_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_iv(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_iv(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2iv_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_offset(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_offset(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6offset_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_is_vector_of_sets(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_is_vector_of_sets(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_17is_vector_of_sets_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_11ChromVector__storage(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector__storage(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8_storage_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_ChromVector[] = {
  {__Pyx_NAMESTR("create"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_create, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("_create_view"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_1_create_view, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("values"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_6values, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("steps"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_7steps, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_8apply, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_11ChromVector_10__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_ChromVector[] = {
  {(char *)"array", __pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_array, __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_array, 0, 0},
  {(char *)"iv", __pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_iv, __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_iv, 0, 0},
  {(char *)"offset", __pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_offset, __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_offset, 0, 0},
  {(char *)"is_vector_of_sets", __pyx_getprop_5HTSeq_6_HTSeq_11ChromVector_is_vector_of_sets, __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector_is_vector_of_sets, 0, 0},
  {(char *)"_storage", __pyx_getprop_5HTSeq_6_HTSeq_11ChromVector__storage, __pyx_setprop_5HTSeq_6_HTSeq_11ChromVector__storage, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ChromVector = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_4__iadd__, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ChromVector = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5HTSeq_6_HTSeq_ChromVector, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ChromVector = {
  0, /*mp_length*/
  __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_2__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5HTSeq_6_HTSeq_ChromVector, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ChromVector = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_ChromVector = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.ChromVector"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_ChromVector), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_ChromVector, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_9__repr__, /*tp_repr*/
  &__pyx_tp_as_number_ChromVector, /*tp_as_number*/
  &__pyx_tp_as_sequence_ChromVector, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ChromVector, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ChromVector, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_ChromVector, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_ChromVector, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_11ChromVector_5__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_ChromVector, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_ChromVector, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_ChromVector, /*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_5HTSeq_6_HTSeq_GenomicArray(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)o);
  p->chrom_vectors = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->typecode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->memmap_dir = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_GenomicArray(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)o;
  Py_XDECREF(((PyObject *)p->chrom_vectors));
  Py_XDECREF(((PyObject *)p->typecode));
  Py_XDECREF(((PyObject *)p->storage));
  Py_XDECREF(((PyObject *)p->memmap_dir));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_GenomicArray(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)o;
  if (p->chrom_vectors) {
    e = (*v)(p->chrom_vectors, a); if (e) return e;
  }
  if (p->typecode) {
    e = (*v)(p->typecode, a); if (e) return e;
  }
  if (p->storage) {
    e = (*v)(p->storage, a); if (e) return e;
  }
  if (p->memmap_dir) {
    e = (*v)(p->memmap_dir, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_GenomicArray(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *p = (struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->chrom_vectors);
  p->chrom_vectors = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->typecode);
  p->typecode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->storage);
  p->storage = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->memmap_dir);
  p->memmap_dir = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_5HTSeq_6_HTSeq_GenomicArray(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_5HTSeq_6_HTSeq_GenomicArray(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_2__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_chrom_vectors(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_12GenomicArray_chrom_vectors(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_13chrom_vectors_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_stranded(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8stranded___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_typecode(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_8typecode___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_auto_add_chroms(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_12GenomicArray_auto_add_chroms(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_15auto_add_chroms_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_storage(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_7storage___get__(o);
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_memmap_dir(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_10memmap_dir___get__(o);
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_GenomicArray[] = {
  {__Pyx_NAMESTR("add_chrom"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_3add_chrom, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_4__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("write_bedgraph_file"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_5write_bedgraph_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("steps"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_6steps, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_GenomicArray[] = {
  {(char *)"chrom_vectors", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_chrom_vectors, __pyx_setprop_5HTSeq_6_HTSeq_12GenomicArray_chrom_vectors, 0, 0},
  {(char *)"stranded", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_stranded, 0, 0, 0},
  {(char *)"typecode", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_typecode, 0, 0, 0},
  {(char *)"auto_add_chroms", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_auto_add_chroms, __pyx_setprop_5HTSeq_6_HTSeq_12GenomicArray_auto_add_chroms, 0, 0},
  {(char *)"storage", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_storage, 0, 0, 0},
  {(char *)"memmap_dir", __pyx_getprop_5HTSeq_6_HTSeq_12GenomicArray_memmap_dir, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GenomicArray = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GenomicArray = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5HTSeq_6_HTSeq_GenomicArray, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_GenomicArray = {
  0, /*mp_length*/
  __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray_1__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5HTSeq_6_HTSeq_GenomicArray, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GenomicArray = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_GenomicArray = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.GenomicArray"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicArray), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_GenomicArray, /*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*/
  &__pyx_tp_as_number_GenomicArray, /*tp_as_number*/
  &__pyx_tp_as_sequence_GenomicArray, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GenomicArray, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GenomicArray, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_GenomicArray, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_GenomicArray, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_GenomicArray, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_GenomicArray, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_12GenomicArray___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_GenomicArray, /*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_5HTSeq_6_HTSeq_BowtieAlignment(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *p;
  PyObject *o = __pyx_tp_new_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)o);
  p->reserved = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->substitutions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_BowtieAlignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)o;
  Py_XDECREF(((PyObject *)p->reserved));
  Py_XDECREF(((PyObject *)p->substitutions));
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_BowtieAlignment(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)o;
  e = __pyx_tp_traverse_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o, v, a); if (e) return e;
  if (p->reserved) {
    e = (*v)(p->reserved, a); if (e) return e;
  }
  if (p->substitutions) {
    e = (*v)(p->substitutions, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_BowtieAlignment(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *p = (struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment *)o;
  PyObject* tmp;
  __pyx_tp_clear_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal(o);
  tmp = ((PyObject*)p->reserved);
  p->reserved = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->substitutions);
  p->substitutions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15BowtieAlignment_reserved(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15BowtieAlignment_reserved(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_8reserved_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_15BowtieAlignment_substitutions(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_15BowtieAlignment_substitutions(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment_13substitutions_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_BowtieAlignment[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_BowtieAlignment[] = {
  {(char *)"reserved", __pyx_getprop_5HTSeq_6_HTSeq_15BowtieAlignment_reserved, __pyx_setprop_5HTSeq_6_HTSeq_15BowtieAlignment_reserved, 0, 0},
  {(char *)"substitutions", __pyx_getprop_5HTSeq_6_HTSeq_15BowtieAlignment_substitutions, __pyx_setprop_5HTSeq_6_HTSeq_15BowtieAlignment_substitutions, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_BowtieAlignment = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_BowtieAlignment = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BowtieAlignment = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_BowtieAlignment = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_BowtieAlignment = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.BowtieAlignment"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_BowtieAlignment), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_BowtieAlignment, /*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*/
  &__pyx_tp_as_number_BowtieAlignment, /*tp_as_number*/
  &__pyx_tp_as_sequence_BowtieAlignment, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BowtieAlignment, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_BowtieAlignment, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("When reading in a Bowtie file, objects of the class BowtieAlignment\n   are returned. In addition to the 'read' and 'iv' fields (see Alignment\n   class), the fields 'reserved' and 'substitutions' are provided. These \n   contain the content of the respective columns of the Bowtie output \n   \n   [A parser for the substitutions field will be added soon.]\n   "), /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_BowtieAlignment, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_BowtieAlignment, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_BowtieAlignment, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_BowtieAlignment, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_15BowtieAlignment___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_BowtieAlignment, /*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_5HTSeq_6_HTSeq_CigarOperation(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)o);
  p->type = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->ref_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq_CigarOperation(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *p = (struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)o;
  Py_XDECREF(((PyObject *)p->type));
  Py_XDECREF(((PyObject *)p->ref_iv));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq_CigarOperation(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *p = (struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)o;
  if (p->type) {
    e = (*v)(p->type, a); if (e) return e;
  }
  if (p->ref_iv) {
    e = (*v)(((PyObject*)p->ref_iv), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq_CigarOperation(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *p = (struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->type);
  p->type = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->ref_iv);
  p->ref_iv = ((struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_type(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_type(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4type_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_size(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_size(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_4size_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_ref_iv(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_ref_iv(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_1__set__(o, v);
  }
  else {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_6ref_iv_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_query_from(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_query_from(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_10query_from_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_query_to(PyObject *o, void *x) {
  return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to___get__(o);
}

static int __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_query_to(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_8query_to_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq_CigarOperation[] = {
  {__Pyx_NAMESTR("check"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_2check, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5HTSeq_6_HTSeq_CigarOperation[] = {
  {(char *)"type", __pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_type, __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_type, 0, 0},
  {(char *)"size", __pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_size, __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_size, 0, 0},
  {(char *)"ref_iv", __pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_ref_iv, __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_ref_iv, 0, 0},
  {(char *)"query_from", __pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_query_from, __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_query_from, 0, 0},
  {(char *)"query_to", __pyx_getprop_5HTSeq_6_HTSeq_14CigarOperation_query_to, __pyx_setprop_5HTSeq_6_HTSeq_14CigarOperation_query_to, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_CigarOperation = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_CigarOperation = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_CigarOperation = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_CigarOperation = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq_CigarOperation = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.CigarOperation"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq_CigarOperation), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq_CigarOperation, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_CigarOperation, /*tp_as_number*/
  &__pyx_tp_as_sequence_CigarOperation, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_CigarOperation, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_CigarOperation, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq_CigarOperation, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq_CigarOperation, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq_CigarOperation, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5HTSeq_6_HTSeq_CigarOperation, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5HTSeq_6_HTSeq_14CigarOperation___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq_CigarOperation, /*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_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)o);
  p->__pyx_v_value = 0;
  return o;
}

static void __pyx_tp_dealloc_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *p = (struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)o;
  Py_XDECREF(p->__pyx_v_value);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *p = (struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)o;
  if (p->__pyx_v_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__(PyObject *o) {
  struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *p = (struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_value);
  p->__pyx_v_value = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct____iadd__ = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct____iadd__ = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct____iadd__ = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct____iadd__ = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("HTSeq._HTSeq.__pyx_scope_struct____iadd__"), /*tp_name*/
  sizeof(struct __pyx_obj_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, /*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*/
  &__pyx_tp_as_number___pyx_scope_struct____iadd__, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct____iadd__, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct____iadd__, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct____iadd__, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, /*tp_traverse*/
  __pyx_tp_clear_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, /*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*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__, /*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("reverse_complement"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_4reverse_complement, METH_O, __Pyx_DOCSTR(__pyx_doc_5HTSeq_6_HTSeq_4reverse_complement)},
  {__Pyx_NAMESTR("parse_cigar"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_5parse_cigar, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("build_cigar_list"), (PyCFunction)__pyx_pf_5HTSeq_6_HTSeq_6build_cigar_list, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_HTSeq"),
    0, /* 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_s_101, __pyx_k_101, sizeof(__pyx_k_101), 0, 0, 1, 0},
  {&__pyx_kp_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 0},
  {&__pyx_kp_s_104, __pyx_k_104, sizeof(__pyx_k_104), 0, 0, 1, 0},
  {&__pyx_kp_s_105, __pyx_k_105, sizeof(__pyx_k_105), 0, 0, 1, 0},
  {&__pyx_kp_s_107, __pyx_k_107, sizeof(__pyx_k_107), 0, 0, 1, 0},
  {&__pyx_kp_s_108, __pyx_k_108, sizeof(__pyx_k_108), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_112, __pyx_k_112, sizeof(__pyx_k_112), 0, 0, 1, 0},
  {&__pyx_kp_s_113, __pyx_k_113, sizeof(__pyx_k_113), 0, 0, 1, 0},
  {&__pyx_kp_u_114, __pyx_k_114, sizeof(__pyx_k_114), 0, 1, 0, 0},
  {&__pyx_kp_u_116, __pyx_k_116, sizeof(__pyx_k_116), 0, 1, 0, 0},
  {&__pyx_kp_u_118, __pyx_k_118, sizeof(__pyx_k_118), 0, 1, 0, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_u_120, __pyx_k_120, sizeof(__pyx_k_120), 0, 1, 0, 0},
  {&__pyx_kp_u_121, __pyx_k_121, sizeof(__pyx_k_121), 0, 1, 0, 0},
  {&__pyx_kp_u_124, __pyx_k_124, sizeof(__pyx_k_124), 0, 1, 0, 0},
  {&__pyx_n_s_129, __pyx_k_129, sizeof(__pyx_k_129), 0, 0, 1, 1},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_n_s_130, __pyx_k_130, sizeof(__pyx_k_130), 0, 0, 1, 1},
  {&__pyx_kp_s_131, __pyx_k_131, sizeof(__pyx_k_131), 0, 0, 1, 0},
  {&__pyx_kp_s_132, __pyx_k_132, sizeof(__pyx_k_132), 0, 0, 1, 0},
  {&__pyx_kp_s_133, __pyx_k_133, sizeof(__pyx_k_133), 0, 0, 1, 0},
  {&__pyx_n_s_135, __pyx_k_135, sizeof(__pyx_k_135), 0, 0, 1, 1},
  {&__pyx_kp_b_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 0, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 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_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 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_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_n_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 1},
  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0},
  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
  {&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
  {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0},
  {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1},
  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
  {&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
  {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
  {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
  {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
  {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1},
  {&__pyx_n_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 1},
  {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
  {&__pyx_n_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 1},
  {&__pyx_n_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 1},
  {&__pyx_kp_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 0},
  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
  {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 0},
  {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
  {&__pyx_kp_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 0},
  {&__pyx_n_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 1},
  {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 0},
  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
  {&__pyx_kp_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 0},
  {&__pyx_kp_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 0},
  {&__pyx_kp_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0},
  {&__pyx_n_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 1},
  {&__pyx_kp_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 0},
  {&__pyx_n_s_94, __pyx_k_94, sizeof(__pyx_k_94), 0, 0, 1, 1},
  {&__pyx_kp_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 0},
  {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
  {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0},
  {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
  {&__pyx_n_s__AlignedRead, __pyx_k__AlignedRead, sizeof(__pyx_k__AlignedRead), 0, 0, 1, 1},
  {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
  {&__pyx_n_s__ChromVector_steps, __pyx_k__ChromVector_steps, sizeof(__pyx_k__ChromVector_steps), 0, 0, 1, 1},
  {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1},
  {&__pyx_n_s__G, __pyx_k__G, sizeof(__pyx_k__G), 0, 0, 1, 1},
  {&__pyx_n_s__GenomicArray_steps, __pyx_k__GenomicArray_steps, sizeof(__pyx_k__GenomicArray_steps), 0, 0, 1, 1},
  {&__pyx_n_s__H, __pyx_k__H, sizeof(__pyx_k__H), 0, 0, 1, 1},
  {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1},
  {&__pyx_n_s__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
  {&__pyx_n_s__Inf, __pyx_k__Inf, sizeof(__pyx_k__Inf), 0, 0, 1, 1},
  {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
  {&__pyx_n_s__M, __pyx_k__M, sizeof(__pyx_k__M), 0, 0, 1, 1},
  {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 1, 1},
  {&__pyx_n_s__P, __pyx_k__P, sizeof(__pyx_k__P), 0, 0, 1, 1},
  {&__pyx_n_s__Read, __pyx_k__Read, sizeof(__pyx_k__Read), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
  {&__pyx_n_s__StepVector, __pyx_k__StepVector, sizeof(__pyx_k__StepVector), 0, 0, 1, 1},
  {&__pyx_n_s__StringIO, __pyx_k__StringIO, sizeof(__pyx_k__StringIO), 0, 0, 1, 1},
  {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1},
  {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1},
  {&__pyx_n_s___HTSeq_internal, __pyx_k___HTSeq_internal, sizeof(__pyx_k___HTSeq_internal), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____iadd__, __pyx_k____iadd__, sizeof(__pyx_k____iadd__), 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____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
  {&__pyx_n_s____reduce__, __pyx_k____reduce__, sizeof(__pyx_k____reduce__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___create_view, __pyx_k___create_view, sizeof(__pyx_k___create_view), 0, 0, 1, 1},
  {&__pyx_n_s___qualarr, __pyx_k___qualarr, sizeof(__pyx_k___qualarr), 0, 0, 1, 1},
  {&__pyx_n_s___qualscale, __pyx_k___qualscale, sizeof(__pyx_k___qualscale), 0, 0, 1, 1},
  {&__pyx_n_s___qualstr, __pyx_k___qualstr, sizeof(__pyx_k___qualstr), 0, 0, 1, 1},
  {&__pyx_n_s___re_cigar_codes, __pyx_k___re_cigar_codes, sizeof(__pyx_k___re_cigar_codes), 0, 0, 1, 1},
  {&__pyx_n_s___storage, __pyx_k___storage, sizeof(__pyx_k___storage), 0, 0, 1, 1},
  {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
  {&__pyx_n_s__add, __pyx_k__add, sizeof(__pyx_k__add), 0, 0, 1, 1},
  {&__pyx_n_s__add_chrom, __pyx_k__add_chrom, sizeof(__pyx_k__add_chrom), 0, 0, 1, 1},
  {&__pyx_n_s__aend, __pyx_k__aend, sizeof(__pyx_k__aend), 0, 0, 1, 1},
  {&__pyx_n_s__aligned, __pyx_k__aligned, sizeof(__pyx_k__aligned), 0, 0, 1, 1},
  {&__pyx_n_s__apply, __pyx_k__apply, sizeof(__pyx_k__apply), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__auto, __pyx_k__auto, sizeof(__pyx_k__auto), 0, 0, 1, 1},
  {&__pyx_n_s__base_to_column, __pyx_k__base_to_column, sizeof(__pyx_k__base_to_column), 0, 0, 1, 1},
  {&__pyx_n_s__bowtie_line, __pyx_k__bowtie_line, sizeof(__pyx_k__bowtie_line), 0, 0, 1, 1},
  {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
  {&__pyx_n_s__cStringIO, __pyx_k__cStringIO, sizeof(__pyx_k__cStringIO), 0, 0, 1, 1},
  {&__pyx_n_s__check, __pyx_k__check, sizeof(__pyx_k__check), 0, 0, 1, 1},
  {&__pyx_n_s__chr, __pyx_k__chr, sizeof(__pyx_k__chr), 0, 0, 1, 1},
  {&__pyx_n_s__chrom, __pyx_k__chrom, sizeof(__pyx_k__chrom), 0, 0, 1, 1},
  {&__pyx_n_s__chrom_vectors, __pyx_k__chrom_vectors, sizeof(__pyx_k__chrom_vectors), 0, 0, 1, 1},
  {&__pyx_n_s__chroms, __pyx_k__chroms, sizeof(__pyx_k__chroms), 0, 0, 1, 1},
  {&__pyx_n_s__cigar, __pyx_k__cigar, sizeof(__pyx_k__cigar), 0, 0, 1, 1},
  {&__pyx_n_s__cigar_pairs, __pyx_k__cigar_pairs, sizeof(__pyx_k__cigar_pairs), 0, 0, 1, 1},
  {&__pyx_n_s__cigar_string, __pyx_k__cigar_string, sizeof(__pyx_k__cigar_string), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
  {&__pyx_n_s__compile, __pyx_k__compile, sizeof(__pyx_k__compile), 0, 0, 1, 1},
  {&__pyx_n_s__contains, __pyx_k__contains, sizeof(__pyx_k__contains), 0, 0, 1, 1},
  {&__pyx_n_s__convert_to_phred, __pyx_k__convert_to_phred, sizeof(__pyx_k__convert_to_phred), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1},
  {&__pyx_n_s__create, __pyx_k__create, sizeof(__pyx_k__create), 0, 0, 1, 1},
  {&__pyx_n_s__csv, __pyx_k__csv, sizeof(__pyx_k__csv), 0, 0, 1, 1},
  {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
  {&__pyx_n_s__deleted, __pyx_k__deleted, sizeof(__pyx_k__deleted), 0, 0, 1, 1},
  {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
  {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
  {&__pyx_n_s__end_d, __pyx_k__end_d, sizeof(__pyx_k__end_d), 0, 0, 1, 1},
  {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
  {&__pyx_n_s__extend_to_include, __pyx_k__extend_to_include, sizeof(__pyx_k__extend_to_include), 0, 0, 1, 1},
  {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1},
  {&__pyx_n_s__file_or_filename, __pyx_k__file_or_filename, sizeof(__pyx_k__file_or_filename), 0, 0, 1, 1},
  {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1},
  {&__pyx_n_s__first, __pyx_k__first, sizeof(__pyx_k__first), 0, 0, 1, 1},
  {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1},
  {&__pyx_n_s__from_SAM_line, __pyx_k__from_SAM_line, sizeof(__pyx_k__from_SAM_line), 0, 0, 1, 1},
  {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1},
  {&__pyx_n_s__getrname, __pyx_k__getrname, sizeof(__pyx_k__getrname), 0, 0, 1, 1},
  {&__pyx_n_s__gettid, __pyx_k__gettid, sizeof(__pyx_k__gettid), 0, 0, 1, 1},
  {&__pyx_n_s__getvalue, __pyx_k__getvalue, sizeof(__pyx_k__getvalue), 0, 0, 1, 1},
  {&__pyx_n_s__gzip, __pyx_k__gzip, sizeof(__pyx_k__gzip), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
  {&__pyx_n_s__inserted, __pyx_k__inserted, sizeof(__pyx_k__inserted), 0, 0, 1, 1},
  {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1},
  {&__pyx_n_s__is_contained_in, __pyx_k__is_contained_in, sizeof(__pyx_k__is_contained_in), 0, 0, 1, 1},
  {&__pyx_n_s__is_duplicate, __pyx_k__is_duplicate, sizeof(__pyx_k__is_duplicate), 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_qcfail, __pyx_k__is_qcfail, sizeof(__pyx_k__is_qcfail), 0, 0, 1, 1},
  {&__pyx_n_s__is_read1, __pyx_k__is_read1, sizeof(__pyx_k__is_read1), 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_secondary, __pyx_k__is_secondary, sizeof(__pyx_k__is_secondary), 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__is_vector_of_sets, __pyx_k__is_vector_of_sets, sizeof(__pyx_k__is_vector_of_sets), 0, 0, 1, 1},
  {&__pyx_n_s__isize, __pyx_k__isize, sizeof(__pyx_k__isize), 0, 0, 1, 1},
  {&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
  {&__pyx_n_s__iv, __pyx_k__iv, sizeof(__pyx_k__iv), 0, 0, 1, 1},
  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1},
  {&__pyx_n_s__log10, __pyx_k__log10, sizeof(__pyx_k__log10), 0, 0, 1, 1},
  {&__pyx_n_s__mapq, __pyx_k__mapq, sizeof(__pyx_k__mapq), 0, 0, 1, 1},
  {&__pyx_n_s__matched, __pyx_k__matched, sizeof(__pyx_k__matched), 0, 0, 1, 1},
  {&__pyx_n_s__mate_aligned, __pyx_k__mate_aligned, sizeof(__pyx_k__mate_aligned), 0, 0, 1, 1},
  {&__pyx_n_s__mate_is_reverse, __pyx_k__mate_is_reverse, sizeof(__pyx_k__mate_is_reverse), 0, 0, 1, 1},
  {&__pyx_n_s__math, __pyx_k__math, sizeof(__pyx_k__math), 0, 0, 1, 1},
  {&__pyx_n_s__max_mm_qual, __pyx_k__max_mm_qual, sizeof(__pyx_k__max_mm_qual), 0, 0, 1, 1},
  {&__pyx_n_s__maxint, __pyx_k__maxint, sizeof(__pyx_k__maxint), 0, 0, 1, 1},
  {&__pyx_n_s__memmap, __pyx_k__memmap, sizeof(__pyx_k__memmap), 0, 0, 1, 1},
  {&__pyx_n_s__memmap_dir, __pyx_k__memmap_dir, sizeof(__pyx_k__memmap_dir), 0, 0, 1, 1},
  {&__pyx_n_s__mismatch_prop, __pyx_k__mismatch_prop, sizeof(__pyx_k__mismatch_prop), 0, 0, 1, 1},
  {&__pyx_n_s__missing, __pyx_k__missing, sizeof(__pyx_k__missing), 0, 0, 1, 1},
  {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
  {&__pyx_n_s__mpos, __pyx_k__mpos, sizeof(__pyx_k__mpos), 0, 0, 1, 1},
  {&__pyx_n_s__mrnm, __pyx_k__mrnm, sizeof(__pyx_k__mrnm), 0, 0, 1, 1},
  {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
  {&__pyx_n_s__ndarray, __pyx_k__ndarray, sizeof(__pyx_k__ndarray), 0, 0, 1, 1},
  {&__pyx_n_s__none, __pyx_k__none, sizeof(__pyx_k__none), 0, 0, 1, 1},
  {&__pyx_n_s__noquals, __pyx_k__noquals, sizeof(__pyx_k__noquals), 0, 0, 1, 1},
  {&__pyx_n_s__not_paired_end, __pyx_k__not_paired_end, sizeof(__pyx_k__not_paired_end), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
  {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1},
  {&__pyx_n_s__ord, __pyx_k__ord, sizeof(__pyx_k__ord), 0, 0, 1, 1},
  {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
  {&__pyx_n_s__overlaps, __pyx_k__overlaps, sizeof(__pyx_k__overlaps), 0, 0, 1, 1},
  {&__pyx_n_s__padded, __pyx_k__padded, sizeof(__pyx_k__padded), 0, 0, 1, 1},
  {&__pyx_n_s__paired_end, __pyx_k__paired_end, sizeof(__pyx_k__paired_end), 0, 0, 1, 1},
  {&__pyx_n_s__path, __pyx_k__path, sizeof(__pyx_k__path), 0, 0, 1, 1},
  {&__pyx_n_s__pattern, __pyx_k__pattern, sizeof(__pyx_k__pattern), 0, 0, 1, 1},
  {&__pyx_n_s__phred, __pyx_k__phred, sizeof(__pyx_k__phred), 0, 0, 1, 1},
  {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
  {&__pyx_n_s__property, __pyx_k__property, sizeof(__pyx_k__property), 0, 0, 1, 1},
  {&__pyx_n_s__pysam, __pyx_k__pysam, sizeof(__pyx_k__pysam), 0, 0, 1, 1},
  {&__pyx_n_s__qfrom, __pyx_k__qfrom, sizeof(__pyx_k__qfrom), 0, 0, 1, 1},
  {&__pyx_n_s__qname, __pyx_k__qname, sizeof(__pyx_k__qname), 0, 0, 1, 1},
  {&__pyx_n_s__qto, __pyx_k__qto, sizeof(__pyx_k__qto), 0, 0, 1, 1},
  {&__pyx_n_s__qual, __pyx_k__qual, sizeof(__pyx_k__qual), 0, 0, 1, 1},
  {&__pyx_n_s__qualscale, __pyx_k__qualscale, sizeof(__pyx_k__qualscale), 0, 0, 1, 1},
  {&__pyx_n_s__qualstr, __pyx_k__qualstr, sizeof(__pyx_k__qualstr), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__raw_optional_fields, __pyx_k__raw_optional_fields, sizeof(__pyx_k__raw_optional_fields), 0, 0, 1, 1},
  {&__pyx_n_s__re, __pyx_k__re, sizeof(__pyx_k__re), 0, 0, 1, 1},
  {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1},
  {&__pyx_n_s__read_as_aligned, __pyx_k__read_as_aligned, sizeof(__pyx_k__read_as_aligned), 0, 0, 1, 1},
  {&__pyx_n_s__ref_iv, __pyx_k__ref_iv, sizeof(__pyx_k__ref_iv), 0, 0, 1, 1},
  {&__pyx_n_s__ref_left, __pyx_k__ref_left, sizeof(__pyx_k__ref_left), 0, 0, 1, 1},
  {&__pyx_n_s__revcomp_of_, __pyx_k__revcomp_of_, sizeof(__pyx_k__revcomp_of_), 0, 0, 1, 1},
  {&__pyx_n_s__rfrom, __pyx_k__rfrom, sizeof(__pyx_k__rfrom), 0, 0, 1, 1},
  {&__pyx_n_s__rstrip, __pyx_k__rstrip, sizeof(__pyx_k__rstrip), 0, 0, 1, 1},
  {&__pyx_n_s__rto, __pyx_k__rto, sizeof(__pyx_k__rto), 0, 0, 1, 1},
  {&__pyx_n_s__samfile, __pyx_k__samfile, sizeof(__pyx_k__samfile), 0, 0, 1, 1},
  {&__pyx_n_s__se, __pyx_k__se, sizeof(__pyx_k__se), 0, 0, 1, 1},
  {&__pyx_n_s__second, __pyx_k__second, sizeof(__pyx_k__second), 0, 0, 1, 1},
  {&__pyx_n_s__seq, __pyx_k__seq, sizeof(__pyx_k__seq), 0, 0, 1, 1},
  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__skipped, __pyx_k__skipped, sizeof(__pyx_k__skipped), 0, 0, 1, 1},
  {&__pyx_n_s__solexa, __pyx_k__solexa, sizeof(__pyx_k__solexa), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
  {&__pyx_n_s__start_d, __pyx_k__start_d, sizeof(__pyx_k__start_d), 0, 0, 1, 1},
  {&__pyx_n_s__start_index, __pyx_k__start_index, sizeof(__pyx_k__start_index), 0, 0, 1, 1},
  {&__pyx_n_s__stderr, __pyx_k__stderr, sizeof(__pyx_k__stderr), 0, 0, 1, 1},
  {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1},
  {&__pyx_n_s__steps, __pyx_k__steps, sizeof(__pyx_k__steps), 0, 0, 1, 1},
  {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1},
  {&__pyx_n_s__storage, __pyx_k__storage, sizeof(__pyx_k__storage), 0, 0, 1, 1},
  {&__pyx_n_s__strand, __pyx_k__strand, sizeof(__pyx_k__strand), 0, 0, 1, 1},
  {&__pyx_n_s__stranded, __pyx_k__stranded, sizeof(__pyx_k__stranded), 0, 0, 1, 1},
  {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
  {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1},
  {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1},
  {&__pyx_n_s__tid, __pyx_k__tid, sizeof(__pyx_k__tid), 0, 0, 1, 1},
  {&__pyx_n_s__track_options, __pyx_k__track_options, sizeof(__pyx_k__track_options), 0, 0, 1, 1},
  {&__pyx_n_s__translate, __pyx_k__translate, sizeof(__pyx_k__translate), 0, 0, 1, 1},
  {&__pyx_n_s__trim_left_end, __pyx_k__trim_left_end, sizeof(__pyx_k__trim_left_end), 0, 0, 1, 1},
  {&__pyx_n_s__trim_right_end, __pyx_k__trim_right_end, sizeof(__pyx_k__trim_right_end), 0, 0, 1, 1},
  {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1},
  {&__pyx_n_s__type_, __pyx_k__type_, sizeof(__pyx_k__type_), 0, 0, 1, 1},
  {&__pyx_n_s__typecode, __pyx_k__typecode, sizeof(__pyx_k__typecode), 0, 0, 1, 1},
  {&__pyx_n_s__unknown, __pyx_k__unknown, sizeof(__pyx_k__unknown), 0, 0, 1, 1},
  {&__pyx_n_s__unnamed, __pyx_k__unnamed, sizeof(__pyx_k__unnamed), 0, 0, 1, 1},
  {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__vec, __pyx_k__vec, sizeof(__pyx_k__vec), 0, 0, 1, 1},
  {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
  {&__pyx_n_s__warn, __pyx_k__warn, sizeof(__pyx_k__warn), 0, 0, 1, 1},
  {&__pyx_n_s__warnings, __pyx_k__warnings, sizeof(__pyx_k__warnings), 0, 0, 1, 1},
  {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
  {&__pyx_n_s__write_to_fastq_file, __pyx_k__write_to_fastq_file, sizeof(__pyx_k__write_to_fastq_file), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_open = __Pyx_GetName(__pyx_b, __pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_chr = __Pyx_GetName(__pyx_b, __pyx_n_s__chr); if (!__pyx_builtin_chr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __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");

  /* "HTSeq/_HTSeq.pyx":585
 *          f = open( file_or_filename, "w" )
 *       if track_options == "":
 *          f.write( "track type=bedGraph\n" )             # <<<<<<<<<<<<<<
 *       else:
 *          f.write( "track type=bedGraph %s\n" % track_options )
 */
  __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_42));
  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_s_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "HTSeq/_HTSeq.pyx":630
 *    work with extended IUPAC nucleotide letters or RNA."""
 * 
 *    return seq[ ::-1 ].translate( _translation_table_for_complementation )             # <<<<<<<<<<<<<<
 * 
 * base_to_column = { 'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4 }
 */
  __pyx_k_slice_46 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_46);
  __Pyx_GIVEREF(__pyx_k_slice_46);

  /* "HTSeq/_HTSeq.pyx":857
 *          fastq_file.write( "@%s\n" % self.name )
 *       fastq_file.write( self.seq + "\n" )
 *       fastq_file.write( "+\n" )             # <<<<<<<<<<<<<<
 *       fastq_file.write( self.qualstr + "\n" )
 * 
 */
  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_69));
  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_69));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_69));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));

  /* "HTSeq/_HTSeq.pyx":870
 *          reverse_complement( self.seq ),
 *          "revcomp_of_" + self.name,
 *          self._qualstr[::-1],             # <<<<<<<<<<<<<<
 *          self._qualscale )
 *       if self._qualarr is not None:
 */
  __pyx_k_slice_71 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_71);
  __Pyx_GIVEREF(__pyx_k_slice_71);

  /* "HTSeq/_HTSeq.pyx":873
 *          self._qualscale )
 *       if self._qualarr is not None:
 *          res._qualarr = self._qualarr[::-1]             # <<<<<<<<<<<<<<
 *       return res
 * 
 */
  __pyx_k_slice_72 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_72);
  __Pyx_GIVEREF(__pyx_k_slice_72);

  /* "HTSeq/_HTSeq.pyx":1051
 *       cdef int positionint
 *       (readId, strand, chrom, position, read, qual,
 *          self.reserved, self.substitutions) = bowtie_line.split( '\t' )             # <<<<<<<<<<<<<<
 *       positionint = int( position )
 *       AlignmentWithSequenceReversal.__init__( self,
 */
  __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_81));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_80));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_80));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_80));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));

  /* "HTSeq/_HTSeq.pyx":1199
 *          import pysam
 *       except ImportError:
 *          sys.stderr.write( "Please Install PySam to use this functionality (http://code.google.com/p/pysam/)" )             # <<<<<<<<<<<<<<
 *          raise
 * 
 */
  __pyx_k_tuple_91 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_91));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_90));
  PyTuple_SET_ITEM(__pyx_k_tuple_91, 0, ((PyObject *)__pyx_kp_s_90));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_90));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));

  /* "HTSeq/_HTSeq.pyx":1272
 *       cdef SequenceWithQualities swq
 * 
 *       fields = line.rstrip().split( "\t" )             # <<<<<<<<<<<<<<
 *       if len( fields ) < 10:
 *          raise ValueError, "SAM line does not contain at least 11 tab-delimited fields."
 */
  __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_95));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_80));
  PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_80));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_80));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));

  /* "HTSeq/_HTSeq.pyx":1279
 *       optional_fields = fields[ 11: ]
 * 
 *       if seq.count( "=" ) > 0:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."
 *       if seq.count( "." ) > 0:
 */
  __pyx_k_tuple_98 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_98));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_97));
  PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_kp_s_97));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_97));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98));

  /* "HTSeq/_HTSeq.pyx":1281
 *       if seq.count( "=" ) > 0:
 *          raise ValueError, "Sequence in SAM file contains '=', which is not supported."
 *       if seq.count( "." ) > 0:             # <<<<<<<<<<<<<<
 *          raise ValueError, "Sequence in SAM file contains '.', which is not supported."
 *       flagint = int( flag )
 */
  __pyx_k_tuple_100 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_100));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100));

  /* "HTSeq/_HTSeq.pyx":1289
 *          cigarlist = None
 *          if rname != "*":     # flag "query sequence is unmapped"
 *             warnings.warn( "Malformed SAM line: RNAME != '*' although flag bit &0x0004 set" )             # <<<<<<<<<<<<<<
 *       else:
 *          if rname == "*":
 */
  __pyx_k_tuple_103 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_103));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_102));
  PyTuple_SET_ITEM(__pyx_k_tuple_103, 0, ((PyObject *)__pyx_kp_s_102));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_102));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_103));

  /* "HTSeq/_HTSeq.pyx":1317
 *          if flagint & 0x0008:      # flag "mate is unmapped"
 *             if mrnm != "*":
 *                warnings.warn( "Malformed SAM line: MRNM != '*' although flag bit &0x0008 set" )             # <<<<<<<<<<<<<<
 *             alnmt.mate_start = None
 *          else:
 */
  __pyx_k_tuple_106 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_106));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_105));
  PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_kp_s_105));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_105));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106));

  /* "HTSeq/_HTSeq.pyx":1332
 *                   alnmt.mate_start.chrom = alnmt.iv.chrom
 *                else:
 *                   warnings.warn( "Malformed SAM line: MRNM == '=' although read is not aligned." )             # <<<<<<<<<<<<<<
 *          if flagint & 0x0040:
 *             alnmt.pe_which = intern( "first" )
 */
  __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_109));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_108));
  PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_108));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_108));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));

  /* "HTSeq/_HTSeq.pyx":1372
 *          query_start = self.iv
 *       else:
 *          query_start = GenomicPosition( "*", -1 )             # <<<<<<<<<<<<<<
 * 
 *       if self.mate_start is not None:
 */
  __pyx_k_tuple_110 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_110));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_93));
  PyTuple_SET_ITEM(__pyx_k_tuple_110, 0, ((PyObject *)__pyx_kp_s_93));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93));
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_110, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_110));

  /* "HTSeq/_HTSeq.pyx":1377
 *          mate_start = self.mate_start
 *       else:
 *          mate_start = GenomicPosition( "*", -1 )             # <<<<<<<<<<<<<<
 * 
 *       if self.cigar is not None:
 */
  __pyx_k_tuple_111 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_111));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_93));
  PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_93));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_93));
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_111, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));

  /* "numpy.pxd":211
 *             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_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_115));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_114));
  PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_u_114));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_114));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));

  /* "numpy.pxd":215
 *             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_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_117));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_116));
  PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_u_116));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_116));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));

  /* "numpy.pxd":253
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' 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_119 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_119));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_118));
  PyTuple_SET_ITEM(__pyx_k_tuple_119, 0, ((PyObject *)__pyx_kp_u_118));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_118));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119));

  /* "numpy.pxd":795
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
  __pyx_k_tuple_122 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_122)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_122));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_121));
  PyTuple_SET_ITEM(__pyx_k_tuple_122, 0, ((PyObject *)__pyx_kp_u_121));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_121));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_122));

  /* "numpy.pxd":799
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' 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_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_123));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_118));
  PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_u_118));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_118));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));

  /* "numpy.pxd":819
 *             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_125 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_125));
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_124));
  PyTuple_SET_ITEM(__pyx_k_tuple_125, 0, ((PyObject *)__pyx_kp_u_124));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_124));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125));

  /* "HTSeq/_HTSeq.pyx":1108
 *       return True
 * 
 * _re_cigar_codes = re.compile( '([A-Z])' )             # <<<<<<<<<<<<<<
 * 
 * cpdef list parse_cigar( str cigar_string, int ref_left = 0, str chrom = "", str strand = "." ):
 */
  __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_134));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_133));
  PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_133));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_133));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));
  __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_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__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_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_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_65 = PyInt_FromLong(65); if (unlikely(!__pyx_int_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_67 = PyInt_FromLong(67); if (unlikely(!__pyx_int_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_70 = PyInt_FromLong(70); if (unlikely(!__pyx_int_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_71 = PyInt_FromLong(71); if (unlikely(!__pyx_int_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_84 = PyInt_FromLong(84); if (unlikely(!__pyx_int_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_97 = PyInt_FromLong(97); if (unlikely(!__pyx_int_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_99 = PyInt_FromLong(99); if (unlikely(!__pyx_int_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_103 = PyInt_FromLong(103); if (unlikely(!__pyx_int_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_116 = PyInt_FromLong(116); if (unlikely(!__pyx_int_116)) {__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 init_HTSeq(void); /*proto*/
PyMODINIT_FUNC init_HTSeq(void)
#else
PyMODINIT_FUNC PyInit__HTSeq(void); /*proto*/
PyMODINIT_FUNC PyInit__HTSeq(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __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__HTSeq(void)");
  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_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_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("_HTSeq"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  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 (__pyx_module_is_main_HTSeq___HTSeq) {
    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 ---*/
  __pyx_v_5HTSeq_6_HTSeq_strand_plus = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5HTSeq_6_HTSeq_strand_minus = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5HTSeq_6_HTSeq_strand_nostrand = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5HTSeq_6_HTSeq_GenomicInterval = &__pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval;
  __pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval.is_contained_in = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_is_contained_in;
  __pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval.contains = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_contains;
  __pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval.overlaps = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_overlaps;
  __pyx_vtable_5HTSeq_6_HTSeq_GenomicInterval.extend_to_include = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, struct __pyx_obj_5HTSeq_6_HTSeq_GenomicInterval *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_15GenomicInterval_extend_to_include;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_GenomicInterval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5HTSeq_6_HTSeq_GenomicInterval, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5HTSeq_6_HTSeq_15GenomicInterval___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5HTSeq_6_HTSeq_15GenomicInterval___init__.doc = __pyx_doc_5HTSeq_6_HTSeq_15GenomicInterval___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5HTSeq_6_HTSeq_15GenomicInterval___init__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_5HTSeq_6_HTSeq_GenomicInterval.tp_dict, __pyx_vtabptr_5HTSeq_6_HTSeq_GenomicInterval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GenomicInterval", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_GenomicInterval) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval = &__pyx_type_5HTSeq_6_HTSeq_GenomicInterval;
  __pyx_vtabptr_5HTSeq_6_HTSeq_GenomicPosition = &__pyx_vtable_5HTSeq_6_HTSeq_GenomicPosition;
  __pyx_vtable_5HTSeq_6_HTSeq_GenomicPosition.__pyx_base = *__pyx_vtabptr_5HTSeq_6_HTSeq_GenomicInterval;
  __pyx_type_5HTSeq_6_HTSeq_GenomicPosition.tp_base = __pyx_ptype_5HTSeq_6_HTSeq_GenomicInterval;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_GenomicPosition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5HTSeq_6_HTSeq_GenomicPosition.tp_dict, __pyx_vtabptr_5HTSeq_6_HTSeq_GenomicPosition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GenomicPosition", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_GenomicPosition) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_GenomicPosition = &__pyx_type_5HTSeq_6_HTSeq_GenomicPosition;
  __pyx_vtabptr_5HTSeq_6_HTSeq_Sequence = &__pyx_vtable_5HTSeq_6_HTSeq_Sequence;
  __pyx_vtable_5HTSeq_6_HTSeq_Sequence.get_reverse_complement = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_8Sequence_get_reverse_complement;
  __pyx_vtable_5HTSeq_6_HTSeq_Sequence.add_bases_to_count_array = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_8Sequence_add_bases_to_count_array;
  __pyx_vtable_5HTSeq_6_HTSeq_Sequence.trim_left_end = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_left_end *__pyx_optional_args))__pyx_f_5HTSeq_6_HTSeq_8Sequence_trim_left_end;
  __pyx_vtable_5HTSeq_6_HTSeq_Sequence.trim_right_end = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_8Sequence_trim_right_end *__pyx_optional_args))__pyx_f_5HTSeq_6_HTSeq_8Sequence_trim_right_end;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_Sequence) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5HTSeq_6_HTSeq_Sequence.tp_dict, __pyx_vtabptr_5HTSeq_6_HTSeq_Sequence) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Sequence", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_Sequence) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_Sequence = &__pyx_type_5HTSeq_6_HTSeq_Sequence;
  __pyx_vtabptr_5HTSeq_6_HTSeq_SequenceWithQualities = &__pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.__pyx_base = *__pyx_vtabptr_5HTSeq_6_HTSeq_Sequence;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.__pyx_base.get_reverse_complement = (struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_get_reverse_complement__pyx_wrap_1;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities._fill_qual_arr = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities__fill_qual_arr;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.add_qual_to_count_array = (PyObject *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_add_qual_to_count_array;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.trim_left_end_with_quals = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals *__pyx_optional_args))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_left_end_with_quals;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.trim_right_end_with_quals = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *, struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch, struct __pyx_opt_args_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals *__pyx_optional_args))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_trim_right_end_with_quals;
  __pyx_vtable_5HTSeq_6_HTSeq_SequenceWithQualities.get_reverse_complement = (struct __pyx_obj_5HTSeq_6_HTSeq_SequenceWithQualities *(*)(struct __pyx_obj_5HTSeq_6_HTSeq_Sequence *, int __pyx_skip_dispatch))__pyx_f_5HTSeq_6_HTSeq_21SequenceWithQualities_get_reverse_complement;
  __pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities.tp_base = __pyx_ptype_5HTSeq_6_HTSeq_Sequence;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5HTSeq_6_HTSeq_21SequenceWithQualities___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5HTSeq_6_HTSeq_21SequenceWithQualities___init__.doc = __pyx_doc_5HTSeq_6_HTSeq_21SequenceWithQualities___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5HTSeq_6_HTSeq_21SequenceWithQualities___init__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities.tp_dict, __pyx_vtabptr_5HTSeq_6_HTSeq_SequenceWithQualities) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SequenceWithQualities", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities = &__pyx_type_5HTSeq_6_HTSeq_SequenceWithQualities;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_Alignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Alignment", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_Alignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_Alignment = &__pyx_type_5HTSeq_6_HTSeq_Alignment;
  __pyx_type_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal.tp_base = __pyx_ptype_5HTSeq_6_HTSeq_Alignment;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "AlignmentWithSequenceReversal", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal = &__pyx_type_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal;
  __pyx_type_5HTSeq_6_HTSeq_SAM_Alignment.tp_base = __pyx_ptype_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_SAM_Alignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "SAM_Alignment", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_SAM_Alignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment = &__pyx_type_5HTSeq_6_HTSeq_SAM_Alignment;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_ChromVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ChromVector", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_ChromVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_ChromVector = &__pyx_type_5HTSeq_6_HTSeq_ChromVector;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_GenomicArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GenomicArray", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_GenomicArray) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_GenomicArray = &__pyx_type_5HTSeq_6_HTSeq_GenomicArray;
  __pyx_type_5HTSeq_6_HTSeq_BowtieAlignment.tp_base = __pyx_ptype_5HTSeq_6_HTSeq_AlignmentWithSequenceReversal;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_BowtieAlignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "BowtieAlignment", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_BowtieAlignment) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_BowtieAlignment = &__pyx_type_5HTSeq_6_HTSeq_BowtieAlignment;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq_CigarOperation) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "CigarOperation", (PyObject *)&__pyx_type_5HTSeq_6_HTSeq_CigarOperation) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq_CigarOperation = &__pyx_type_5HTSeq_6_HTSeq_CigarOperation;
  if (PyType_Ready(&__pyx_type_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__ = &__pyx_type_5HTSeq_6_HTSeq___pyx_scope_struct____iadd__;
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "HTSeq/_HTSeq.pyx":1
 * import sys             # <<<<<<<<<<<<<<
 * import os
 * import math
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":2
 * import sys
 * import os             # <<<<<<<<<<<<<<
 * import math
 * import re
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":3
 * import sys
 * import os
 * import math             # <<<<<<<<<<<<<<
 * import re
 * import csv
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__math), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__math, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":4
 * import os
 * import math
 * import re             # <<<<<<<<<<<<<<
 * import csv
 * import gzip
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__re), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__re, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":5
 * import math
 * import re
 * import csv             # <<<<<<<<<<<<<<
 * import gzip
 * import itertools
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__csv), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csv, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":6
 * import re
 * import csv
 * import gzip             # <<<<<<<<<<<<<<
 * import itertools
 * import collections
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gzip), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gzip, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":7
 * import csv
 * import gzip
 * import itertools             # <<<<<<<<<<<<<<
 * import collections
 * import cStringIO
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itertools, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":8
 * import gzip
 * import itertools
 * import collections             # <<<<<<<<<<<<<<
 * import cStringIO
 * import warnings
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":9
 * import itertools
 * import collections
 * import cStringIO             # <<<<<<<<<<<<<<
 * import warnings
 * import numpy
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__cStringIO), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cStringIO, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":10
 * import collections
 * import cStringIO
 * import warnings             # <<<<<<<<<<<<<<
 * import numpy
 * cimport numpy
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":11
 * import cStringIO
 * import warnings
 * import numpy             # <<<<<<<<<<<<<<
 * cimport numpy
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":14
 * cimport numpy
 * 
 * import StepVector             # <<<<<<<<<<<<<<
 * import _HTSeq_internal
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__StepVector), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__StepVector, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":15
 * 
 * import StepVector
 * import _HTSeq_internal             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s___HTSeq_internal), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___HTSeq_internal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":22
 * ###########################
 * 
 * cdef str strand_plus = intern( "+" )             # <<<<<<<<<<<<<<
 * cdef str strand_minus = intern( "-" )
 * cdef str strand_nostrand = intern( "." )
 */
  __pyx_t_1 = ((PyObject *)__pyx_kp_s_37);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Intern(__pyx_t_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(__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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus));
  __Pyx_DECREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_plus));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_5HTSeq_6_HTSeq_strand_plus = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":23
 * 
 * cdef str strand_plus = intern( "+" )
 * cdef str strand_minus = intern( "-" )             # <<<<<<<<<<<<<<
 * cdef str strand_nostrand = intern( "." )
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_kp_s_38);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Intern(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  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 = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus));
  __Pyx_DECREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_minus));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_v_5HTSeq_6_HTSeq_strand_minus = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":24
 * cdef str strand_plus = intern( "+" )
 * cdef str strand_minus = intern( "-" )
 * cdef str strand_nostrand = intern( "." )             # <<<<<<<<<<<<<<
 * 
 * cdef class GenomicInterval:
 */
  __pyx_t_1 = ((PyObject *)__pyx_kp_s_11);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Intern(__pyx_t_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);
  __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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
  __Pyx_DECREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_5HTSeq_6_HTSeq_strand_nostrand = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":54
 * 
 *    def __init__( GenomicInterval self, str chrom, long start, long end,
 *          str strand = strand_nostrand ):             # <<<<<<<<<<<<<<
 *       """See the class docstring for the meaning of the slots. Note that
 *       there is also a factory function, 'from_directional', to be used if
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq_strand_nostrand));
  __pyx_k_1 = __pyx_v_5HTSeq_6_HTSeq_strand_nostrand;
  __Pyx_GIVEREF(__pyx_v_5HTSeq_6_HTSeq_strand_nostrand);

  /* "HTSeq/_HTSeq.pyx":249
 * 
 * 
 * def GenomicInterval_from_directional( str chrom, long int start_d, long int length, str strand="." ):             # <<<<<<<<<<<<<<
 *    strand = intern( strand )
 *    if strand.se is not strand_minus:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5HTSeq_6_HTSeq_GenomicInterval_from_directional, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_129, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":323
 * 
 *    @classmethod
 *    def create( cls, GenomicInterval iv, str typecode, str storage, str memmap_dir = "" ):             # <<<<<<<<<<<<<<
 *       ncv = cls()
 *       ncv.iv = iv
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector, __pyx_n_s__create); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector->tp_dict, __pyx_n_s__create, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_ChromVector);

  /* "HTSeq/_HTSeq.pyx":346
 * 
 *    @classmethod
 *    def _create_view( cls, ChromVector vec, GenomicInterval iv ):             # <<<<<<<<<<<<<<
 *       if iv.length == 0:
 *          raise IndexError, "Cannot subset to zero-length interval."
 */
  __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector, __pyx_n_s___create_view); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_ChromVector->tp_dict, __pyx_n_s___create_view, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_ChromVector);

  /* "HTSeq/_HTSeq.pyx":469
 *          ( self.array, self.iv, self.offset, self.is_vector_of_sets, self._storage ) )
 * 
 * def _ChromVector_unpickle( array, iv, offset, is_vector_of_sets, _storage ):             # <<<<<<<<<<<<<<
 *    cv = ChromVector()
 *    cv.array =  array
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5HTSeq_6_HTSeq_1_ChromVector_unpickle, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_29, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":553
 *          raise TypeError, "Illegal index type."
 * 
 *    def add_chrom( self, chrom, length = sys.maxint, start_index = 0 ):             # <<<<<<<<<<<<<<
 *       cdef GenomicInterval iv
 *       if length == sys.maxint:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__maxint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_k_36 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":600
 * 
 * 
 * def _GenomicArray_unpickle( stranded, typecode, chrom_vectors ):             # <<<<<<<<<<<<<<
 *    ga = GenomicArray( {}, stranded, typecode )
 *    ga.chrom_vectors = chrom_vectors
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5HTSeq_6_HTSeq_2_GenomicArray_unpickle, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_39, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":612
 * 
 * 
 * def _make_translation_table_for_complementation( ):             # <<<<<<<<<<<<<<
 *    t = [ chr(i) for i in xrange(256) ]
 *    t[ ord('A') ] = 'T'
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5HTSeq_6_HTSeq_3_make_translation_table_for_complementation, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_130, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "HTSeq/_HTSeq.pyx":624
 *    return ''.join( t )
 * 
 * cdef bytes _translation_table_for_complementation = _make_translation_table_for_complementation( )             # <<<<<<<<<<<<<<
 * 
 * cpdef bytes reverse_complement( bytes seq ):
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_130); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XGOTREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation));
  __Pyx_DECREF(((PyObject *)__pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_v_5HTSeq_6_HTSeq__translation_table_for_complementation = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":632
 *    return seq[ ::-1 ].translate( _translation_table_for_complementation )
 * 
 * base_to_column = { 'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4 }             # <<<<<<<<<<<<<<
 * 
 * cdef class Sequence( object ):
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__A), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__C), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__G), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__T), __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__N), __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__base_to_column, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":829
 * 
 *    @property
 *    def qualstr( self ):             # <<<<<<<<<<<<<<
 *       cdef int seqlen
 *       cdef char * qualstr_phred_cstr = self._qualstr_phred
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities, __pyx_n_s__qualstr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities->tp_dict, __pyx_n_s__qualstr, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_SequenceWithQualities);

  /* "HTSeq/_HTSeq.pyx":977
 * 
 *    @property
 *    def read( self ):             # <<<<<<<<<<<<<<
 *       return self._read
 * 
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __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 = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment->tp_dict, __pyx_n_s__read, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_Alignment);

  /* "HTSeq/_HTSeq.pyx":994
 * 
 *    @property
 *    def paired_end( self ):             # <<<<<<<<<<<<<<
 *       return False
 * 
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment, __pyx_n_s__paired_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __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 = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment->tp_dict, __pyx_n_s__paired_end, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_Alignment);

  /* "HTSeq/_HTSeq.pyx":998
 * 
 *    @property
 *    def aligned( self ):             # <<<<<<<<<<<<<<
 *       """Returns True unless self.iv is None. The latter indicates that
 *       this record decribes a read for which no alignment was found.
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment, __pyx_n_s__aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __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 = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_Alignment->tp_dict, __pyx_n_s__aligned, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_Alignment);

  /* "HTSeq/_HTSeq.pyx":1058
 * 
 * 
 * cigar_operation_names = {             # <<<<<<<<<<<<<<
 *    'M': 'matched',
 *    'I': 'inserted',
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__M), ((PyObject *)__pyx_n_s__matched)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__I), ((PyObject *)__pyx_n_s__inserted)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__D), ((PyObject *)__pyx_n_s__deleted)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__N), ((PyObject *)__pyx_n_s__skipped)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__S), ((PyObject *)__pyx_kp_s_131)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__H), ((PyObject *)__pyx_kp_s_132)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__P), ((PyObject *)__pyx_n_s__padded)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_84, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1108
 *       return True
 * 
 * _re_cigar_codes = re.compile( '([A-Z])' )             # <<<<<<<<<<<<<<
 * 
 * cpdef list parse_cigar( str cigar_string, int ref_left = 0, str chrom = "", str strand = "." ):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__re); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__compile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___re_cigar_codes, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1182
 *       raise ValueError, "SAM optional field with illegal type letter '%s'" % field[2]
 * 
 * cigar_operation_codes = [ 'M', 'I', 'D', 'N', 'S', 'H', 'P', '=', 'X']             # <<<<<<<<<<<<<<
 * cigar_operation_code_dict = dict( [ (x,i) for i,x in enumerate( cigar_operation_codes ) ] )
 * 
 */
  __pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__M));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__M));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__M));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__I));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__I));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
  PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__D));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__S));
  PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s__S));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__H));
  PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_s__H));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__H));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__P));
  PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_s__P));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__P));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_97));
  PyList_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_kp_s_97));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_97));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__X));
  PyList_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_n_s__X));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_94, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1183
 * 
 * cigar_operation_codes = [ 'M', 'I', 'D', 'N', 'S', 'H', 'P', '=', 'X']
 * cigar_operation_code_dict = dict( [ (x,i) for i,x in enumerate( cigar_operation_codes ) ] )             # <<<<<<<<<<<<<<
 * 
 * cdef class SAM_Alignment( AlignmentWithSequenceReversal ):
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_94); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else if (PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else {
      __pyx_t_3 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__x, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__i, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __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 = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_92, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "HTSeq/_HTSeq.pyx":1226
 * 
 *    @classmethod
 *    def from_pysam_AlignedRead( cls, read, samfile ):             # <<<<<<<<<<<<<<
 *       strand = "-" if read.is_reverse else "+"
 *       if not read.is_unmapped:
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment, __pyx_n_s_135); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment->tp_dict, __pyx_n_s_135, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment);

  /* "HTSeq/_HTSeq.pyx":1263
 * 
 *    @classmethod
 *    def from_SAM_line( cls, line ):             # <<<<<<<<<<<<<<
 *       cdef str qname, flag, rname, pos, mapq, cigar,
 *       cdef str mrnm, mpos, isize, seq, qual
 */
  __pyx_t_1 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment, __pyx_n_s__from_SAM_line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment->tp_dict, __pyx_n_s__from_SAM_line, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment);

  /* "HTSeq/_HTSeq.pyx":1357
 * 
 *    @property
 *    def paired_end( self ):             # <<<<<<<<<<<<<<
 *       return self.pe_which != "not_paired_end"
 * 
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment, __pyx_n_s__paired_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __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 = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment->tp_dict, __pyx_n_s__paired_end, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment);

  /* "HTSeq/_HTSeq.pyx":1361
 * 
 *    @property
 *    def mate_aligned( self ):             # <<<<<<<<<<<<<<
 *       return self.mate_start is not None
 * 
 */
  __pyx_t_2 = __Pyx_GetName((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment, __pyx_n_s__mate_aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __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 = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment->tp_dict, __pyx_n_s__mate_aligned, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5HTSeq_6_HTSeq_SAM_Alignment);

  /* "HTSeq/_HTSeq.pyx":1
 * import sys             # <<<<<<<<<<<<<<
 * import os
 * import math
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "numpy.pxd":971
 *      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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    __Pyx_AddTraceback("init HTSeq._HTSeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init HTSeq._HTSeq");
  }
  __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_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

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 %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_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_AS_STRING(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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    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 void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    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;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        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) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        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:
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}


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 CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
                                     Py_ssize_t start, Py_ssize_t end, int direction) {
    if (unlikely(PyTuple_Check(substr))) {
        int result;
        Py_ssize_t i;
        for (i = 0; i < PyTuple_GET_SIZE(substr); i++) {
            result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i),
                                         start, end, direction);
            if (result) {
                return result;
            }
        }
        return 0;
    }
    return PyUnicode_Tailmatch(s, substr, start, end, direction);
}

static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                         Py_ssize_t end, int direction)
{
    const char* self_ptr = PyBytes_AS_STRING(self);
    Py_ssize_t self_len = PyBytes_GET_SIZE(self);
    const char* sub_ptr;
    Py_ssize_t sub_len;
    int retval;

#if PY_VERSION_HEX >= 0x02060000
    Py_buffer view;
    view.obj = NULL;
#endif

    if ( PyBytes_Check(arg) ) {
        sub_ptr = PyBytes_AS_STRING(arg);
        sub_len = PyBytes_GET_SIZE(arg);
    }
#if PY_MAJOR_VERSION < 3
    // Python 2.x allows mixing unicode and str
    else if ( PyUnicode_Check(arg) ) {
        return PyUnicode_Tailmatch(self, arg, start, end, direction);
    }
#endif
    else {
#if PY_VERSION_HEX < 0x02060000
        if (unlikely(PyObject_AsCharBuffer(arg, &sub_ptr, &sub_len)))
            return -1;
#else
        if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1))
            return -1;
        sub_ptr = (const char*) view.buf;
        sub_len = view.len;
#endif
    }

    if (end > self_len)
        end = self_len;
    else if (end < 0)
        end += self_len;
    if (end < 0)
        end = 0;
    if (start < 0)
        start += self_len;
    if (start < 0)
        start = 0;

    if (direction > 0) {
        /* endswith */
        if (end-sub_len > start)
            start = end - sub_len;
    }

    if (start + sub_len <= end)
        retval = !memcmp(self_ptr+start, sub_ptr, sub_len);
    else
        retval = 0;

#if PY_VERSION_HEX >= 0x02060000
    if (view.obj)
        PyBuffer_Release(&view);
#endif

    return retval;
}

static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start,
                                   Py_ssize_t end, int direction)
{
    if (unlikely(PyTuple_Check(substr))) {
        int result;
        Py_ssize_t i;
        for (i = 0; i < PyTuple_GET_SIZE(substr); i++) {
            result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i),
                                                   start, end, direction);
            if (result) {
                return result;
            }
        }
        return 0;
    }

    return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction);
}


static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start,
                                               Py_ssize_t end, int direction)
{
    if (PY_MAJOR_VERSION < 3)
        return __Pyx_PyBytes_Tailmatch(self, arg, start, end, direction);
    else
        return __Pyx_PyUnicode_Tailmatch(self, arg, start, end, direction);
}

static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}

typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
} __Pyx_BufFmt_Context;

static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}

static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}

static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}

static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'b': return "'char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 0: return "end";
    default: return "unparseable format string";
  }
}

static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif

static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}

static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
    case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
    case 'O': return 'O';
    case 'P': return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}

static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}

static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset;
  if (ctx->enc_type == 0) return 0;
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;

    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
    }

    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        /* special case -- treat as struct rather than complex number */
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }

      __Pyx_BufFmt_RaiseExpected(ctx);
      return -1;
    }

    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }

    ctx->fmt_offset += size;

    --ctx->enc_count; /* Consume from buffer string */

    /* Done checking, move to next field, pushing or popping struct stack if needed */
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}

static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        ++ts;
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          /* Continue pooling same type */
          ctx->enc_count += ctx->new_count;
        } else {
          /* New type */
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ParseNumber(&ts);
          if (number == -1) { /* First char was not a digit */
            PyErr_Format(PyExc_ValueError,
                         "Does not understand character buffer dtype format string ('%c')", *ts);
            return NULL;
          }
          ctx->new_count = (size_t)number; 
        }
    }
  }
}

static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}

static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}

static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}


static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}


static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    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;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    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 (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}


static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
        return PyFloat_AsDouble(obj);
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    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);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  #if PY_VERSION_HEX >= 0x02060000
  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  #endif
  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags);
  else {
  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  return -1;
    }
}

static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  PyObject* obj = view->obj;
  if (obj) {
    #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;}
    #endif
    if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view);
    Py_DECREF(obj);
    view->obj = NULL;
  }
}

#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    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
    {
        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
    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:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject* __Pyx_Intern(PyObject* s) {
    if (!(likely(PyString_CheckExact(s)))) {
        PyErr_Format(PyExc_TypeError, "Expected str, got %s", Py_TYPE(s)->tp_name);
        return 0;
    }
    Py_INCREF(s);
    #if PY_MAJOR_VERSION >= 3
    PyUnicode_InternInPlace(&s);
    #else
    PyString_InternInPlace(&s);
    #endif
    return s;
}

static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
    /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */
    static PyTypeObject *methoddescr_type = NULL;
    if (methoddescr_type == NULL) {
       PyObject *meth = __Pyx_GetAttrString((PyObject*)&PyList_Type, "append");
       if (!meth) return NULL;
       methoddescr_type = Py_TYPE(meth);
       Py_DECREF(meth);
    }
    if (PyObject_TypeCheck(method, methoddescr_type)) { /* cdef classes */
        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
        #if PY_VERSION_HEX < 0x03020000
        PyTypeObject *d_type = descr->d_type;
        #else
        PyTypeObject *d_type = descr->d_common.d_type;
        #endif
        return PyDescr_NewClassMethod(d_type, descr->d_method);
    }
    else if (PyMethod_Check(method)) { /* python classes */
        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
    }
    else if (PyCFunction_Check(method)) {
        return PyClassMethod_New(method);
    }
#ifdef __pyx_binding_PyCFunctionType_USED
    else if (PyObject_TypeCheck(method, __pyx_binding_PyCFunctionType)) { /* binded CFunction */
        return PyClassMethod_New(method);
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "Class-level classmethod() can only be called on "
                 "a method_descriptor or instance method.");
    return NULL;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        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;
    }
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
            else
                return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
        } 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;
    }
}


static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
    __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
    if (op == NULL)
        return NULL;
    op->func.m_ml = ml;
    Py_XINCREF(self);
    op->func.m_self = self;
    Py_XINCREF(module);
    op->func.m_module = module;
    PyObject_GC_Track(op);
    return (PyObject *)op;
}

static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
    PyObject_GC_UnTrack(m);
    Py_XDECREF(m->func.m_self);
    Py_XDECREF(m->func.m_module);
    PyObject_GC_Del(m);
}

static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
    if (obj == Py_None)
            obj = NULL;
    return PyMethod_New(func, obj, type);
}

static int __pyx_binding_PyCFunctionType_init(void) {
    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
        return -1;
    }
    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
    return 0;

}

static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) {
    const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(Py_intptr_t) == sizeof(char)) {
        if (is_unsigned)
            return (Py_intptr_t)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (Py_intptr_t)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(Py_intptr_t) == sizeof(short)) {
        if (is_unsigned)
            return (Py_intptr_t)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (Py_intptr_t)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(Py_intptr_t) == sizeof(int)) {
        if (is_unsigned)
            return (Py_intptr_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (Py_intptr_t)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(Py_intptr_t) == sizeof(long)) {
        if (is_unsigned)
            return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (Py_intptr_t)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (Py_intptr_t)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        Py_intptr_t val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (Py_intptr_t)-1;
    }
}

static CYTHON_INLINE long __Pyx_pow_long(long b, long e) {
    long t = b;
    switch (e) {
        case 3:
            t *= b;
        case 2:
            t *= b;
        case 1:
            return t;
        case 0:
            return 1;
    }
    if (unlikely(e<0)) return 0;
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);    /* 1 or b */
        b *= b;
        e >>= 1;
    }
    return t;
}

static CYTHON_INLINE npy_long __Pyx_PyInt_from_py_npy_long(PyObject* x) {
    const npy_long neg_one = (npy_long)-1, const_zero = (npy_long)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(npy_long) == sizeof(char)) {
        if (is_unsigned)
            return (npy_long)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (npy_long)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(npy_long) == sizeof(short)) {
        if (is_unsigned)
            return (npy_long)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (npy_long)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(npy_long) == sizeof(int)) {
        if (is_unsigned)
            return (npy_long)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_long)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(npy_long) == sizeof(long)) {
        if (is_unsigned)
            return (npy_long)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (npy_long)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(npy_long) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (npy_long)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (npy_long)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        npy_long val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (npy_long)-1;
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) {
    const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(Py_intptr_t) == sizeof(char))  ||
        (sizeof(Py_intptr_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(Py_intptr_t) == sizeof(int)) ||
               (sizeof(Py_intptr_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

#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);
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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;
    }
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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;
    }
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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;
    }
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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;
    }
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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;
    }
}

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_VERSION_HEX < 0x03000000
    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 (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 {
            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 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;
}

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_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#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_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    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;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)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 (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)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

#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;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    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

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #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_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        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,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) 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 = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    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;
}

/* Type Conversion Functions */

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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
  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_VERSION_HEX < 0x03000000
    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)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
