/* Generated by Cython 0.29.4 */

#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.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_4"
#define CYTHON_HEX_VERSION 0x001D04F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#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
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif 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

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_USE_DICT_VERSIONS
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
        static PY_UINT64_T __pyx_dict_version = 0;\
        static PyObject *__pyx_dict_cached_value = NULL;\
        if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
            (VAR) = __pyx_dict_cached_value;\
        } else {\
            (VAR) = __pyx_dict_cached_value = (LOOKUP);\
            __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
        }\
    }
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #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 CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#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
  #define PyObject_Unicode             PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  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_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

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

#define __PYX_HAVE__variantcaller
#define __PYX_HAVE_API__variantcaller
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "pythread.h"
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
#include "ctype.h"
#include "string.h"
#include "stdint.h"
#include "htslib/bgzf.h"
#include "htslib/hts.h"
#include "htslib/sam.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

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

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "cython/variantcaller.pyx",
  "cython/fastafile.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
  "cython/htslibWrapper.pxd",
  "cython/variant.pxd",
  "cython/cwindow.pxd",
  "cython/cpopulation.pxd",
  "cython/chaplotype.pxd",
  "cython/cgenotype.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_9fastafile_FastaIndex;
struct __pyx_obj_9fastafile_FastaFile;
struct __pyx_obj_13htslibWrapper_Samfile;
struct __pyx_obj_13htslibWrapper_ReadIterator;
struct __pyx_obj_7variant_Variant;
struct __pyx_obj_7variant_VariantCandidateGenerator;
struct __pyx_obj_7cwindow_ReadArray;
struct __pyx_obj_7cwindow_bamReadBuffer;
struct __pyx_obj_11cpopulation_Population;
struct __pyx_obj_10chaplotype_Haplotype;
struct __pyx_obj_9cgenotype_DiploidGenotype;
struct __pyx_obj_9cgenotype_HaploidGenotype;
struct __pyx_t_13htslibWrapper_cAlignedRead;
typedef struct __pyx_t_13htslibWrapper_cAlignedRead __pyx_t_13htslibWrapper_cAlignedRead;
struct __pyx_opt_args_13htslibWrapper_7Samfile__open;

/* "htslibWrapper.pxd":187
 *     int bam_cigar_oplen(uint32_t c)
 * 
 * ctypedef struct cAlignedRead:             # <<<<<<<<<<<<<<
 *     char* seq
 *     char* qual
 */
struct __pyx_t_13htslibWrapper_cAlignedRead {
  char *seq;
  char *qual;
  short *cigarOps;
  short *hash;
  short mateChromID;
  short cigarLen;
  short chromID;
  short rlen;
  int pos;
  int end;
  int insertSize;
  int matePos;
  int bitFlag;
  unsigned char mapq;
};

/* "htslibWrapper.pxd":211
 *     cdef _hasIndex(self)
 *     cdef void openBAMFile(self, mode)
 *     cpdef _open(self, mode, loadIndex=*)             # <<<<<<<<<<<<<<
 *     cdef char* getrname(self, int tid)
 *     cpdef ReadIterator fetch(self, const char *region)
 */
struct __pyx_opt_args_13htslibWrapper_7Samfile__open {
  int __pyx_n;
  PyObject *loadIndex;
};
struct __pyx_opt_args_11cpopulation_10Population_calculatePosterior;

/* "cpopulation.pxd":47
 *     # Class functions
 *     cdef:
 *         double calculatePosterior(self, Variant var, int flatPrior=*)             # <<<<<<<<<<<<<<
 *         void computeVariantPosteriors(self)
 *         void computeVariantINFO(self)
 */
struct __pyx_opt_args_11cpopulation_10Population_calculatePosterior {
  int __pyx_n;
  int flatPrior;
};
struct __pyx_opt_args_10chaplotype_9Haplotype_getReferenceSequence;

/* "chaplotype.pxd":46
 *         double* alignReads(self, int individualIndex, cAlignedRead** start, cAlignedRead** end, cAlignedRead** badReadStart, cAlignedRead** badReadsEnd, cAlignedRead** brokenReadsStart, cAlignedRead** brokenReadsEnd, int useMapQualCap)
 *         double alignSingleRead(self, cAlignedRead* theRead, int useMapQualCap)
 *         char* getReferenceSequence(self, prefix=*)             # <<<<<<<<<<<<<<
 *         char* getMutatedSequence(self)
 *         char* getShortHaplotypeSequence(self)
 */
struct __pyx_opt_args_10chaplotype_9Haplotype_getReferenceSequence {
  int __pyx_n;
  PyObject *prefix;
};

/* "fastafile.pxd":1
 * cdef class FastaIndex:             # <<<<<<<<<<<<<<
 *     cdef object theFile
 *     cdef dict getRefs(self, int parseNCBI)
 */
struct __pyx_obj_9fastafile_FastaIndex {
  PyObject_HEAD
  struct __pyx_vtabstruct_9fastafile_FastaIndex *__pyx_vtab;
  PyObject *theFile;
};


/* "fastafile.pxd":5
 *     cdef dict getRefs(self, int parseNCBI)
 * 
 * cdef class FastaFile(object):             # <<<<<<<<<<<<<<
 *     cdef object theFile
 *     cdef FastaIndex theIndex
 */
struct __pyx_obj_9fastafile_FastaFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_9fastafile_FastaFile *__pyx_vtab;
  PyObject *theFile;
  struct __pyx_obj_9fastafile_FastaIndex *theIndex;
  PyObject *refs;
  PyObject *cache;
  PyObject *cacheRefName;
  PY_LONG_LONG cacheStartPos;
  PY_LONG_LONG cacheEndPos;
};


/* "htslibWrapper.pxd":203
 *     unsigned char mapq
 * 
 * cdef class Samfile:             # <<<<<<<<<<<<<<
 *     cdef void clearHeader(self)
 *     cdef void clearIndex(self)
 */
struct __pyx_obj_13htslibWrapper_Samfile {
  PyObject_HEAD
  struct __pyx_vtabstruct_13htslibWrapper_Samfile *__pyx_vtab;
  char *filename;
  samFile *samfile;
  bam_hdr_t *theHeader;
  hts_idx_t *index;
  PyObject *lock;
};


/* "htslibWrapper.pxd":222
 *     cdef object lock
 * 
 * cdef class ReadIterator:             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead* get(self, int storeRgID, char** rgID)
 *     cdef int cnext(self) nogil
 */
struct __pyx_obj_13htslibWrapper_ReadIterator {
  PyObject_HEAD
  struct __pyx_vtabstruct_13htslibWrapper_ReadIterator *__pyx_vtab;
  samFile *theSamfile;
  hts_itr_t *theIterator;
  bam1_t *b;
};


/* "variant.pxd":17
 * 
 * @cython.final
 * cdef class Variant:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public bytes refName
 */
struct __pyx_obj_7variant_Variant {
  PyObject_HEAD
  struct __pyx_vtabstruct_7variant_Variant *__pyx_vtab;
  PyObject *refName;
  PyObject *added;
  PyObject *removed;
  PyObject *bamAdded;
  PyObject *bamRemoved;
  int refPos;
  int bamMinPos;
  int bamMaxPos;
  int minRefPos;
  int maxRefPos;
  int nSupportingReads;
  int varSource;
  int hashValue;
  int nAdded;
  int nRemoved;
  int varType;
};


/* "variant.pxd":44
 * 
 * @cython.final
 * cdef class VariantCandidateGenerator:             # <<<<<<<<<<<<<<
 *     cdef int CIGAR_M
 *     cdef int CIGAR_I
 */
struct __pyx_obj_7variant_VariantCandidateGenerator {
  PyObject_HEAD
  struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *__pyx_vtab;
  int CIGAR_M;
  int CIGAR_I;
  int CIGAR_D;
  int CIGAR_N;
  int CIGAR_S;
  int CIGAR_H;
  int CIGAR_P;
  int CIGAR_EQ;
  int CIGAR_X;
  int minMapQual;
  int minBaseQual;
  int minFlank;
  int refId;
  int maxCoverage;
  int verbosity;
  int genSNPs;
  int genIndels;
  int maxReadLength;
  long rStart;
  long rEnd;
  long refSeqStart;
  long refSeqEnd;
  char *refSeq;
  PyObject *variantHeap;
  PyObject *pyRefSeq;
  PyObject *rname;
  struct __pyx_obj_9fastafile_FastaFile *refFile;
  PyObject *options;
  int qualBinSize;
};


/* "cwindow.pxd":13
 * ###################################################################################################
 * 
 * cdef class ReadArray:             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead** array
 *     cdef cAlignedRead** windowStart
 */
struct __pyx_obj_7cwindow_ReadArray {
  PyObject_HEAD
  struct __pyx_vtabstruct_7cwindow_ReadArray *__pyx_vtab;
  __pyx_t_13htslibWrapper_cAlignedRead **array;
  __pyx_t_13htslibWrapper_cAlignedRead **windowStart;
  __pyx_t_13htslibWrapper_cAlignedRead **windowEnd;
  int __pyx___size;
  int __pyx___capacity;
  int __pyx___longestRead;
};


/* "cwindow.pxd":29
 * ###################################################################################################
 * 
 * cdef class bamReadBuffer:             # <<<<<<<<<<<<<<
 *     cdef char* chrom
 *     cdef int chromID
 */
struct __pyx_obj_7cwindow_bamReadBuffer {
  PyObject_HEAD
  struct __pyx_vtabstruct_7cwindow_bamReadBuffer *__pyx_vtab;
  char *chrom;
  int chromID;
  int *filteredReadCountsByType;
  int isSorted;
  int startBase;
  int endBase;
  int windowStartBase;
  int windowEndBase;
  int maxReads;
  int minMapQual;
  int minBaseQual;
  int minFlank;
  int trimReadFlank;
  int verbosity;
  int minGoodBases;
  int trimOverlapping;
  int trimAdapter;
  int trimSoftClipped;
  __pyx_t_13htslibWrapper_cAlignedRead *lastRead;
  PyObject *sample;
  struct __pyx_obj_7cwindow_ReadArray *reads;
  struct __pyx_obj_7cwindow_ReadArray *badReads;
  struct __pyx_obj_7cwindow_ReadArray *brokenMates;
};


/* "cpopulation.pxd":12
 * ###################################################################################################
 * 
 * cdef class Population:             # <<<<<<<<<<<<<<
 * 
 *     # Class variables
 */
struct __pyx_obj_11cpopulation_Population {
  PyObject_HEAD
  struct __pyx_vtabstruct_11cpopulation_Population *__pyx_vtab;
  PyObject *vcfInfo;
  PyObject *vcfFilter;
  PyObject *varsByPos;
  PyObject *variantPosteriors;
  PyObject *genotypeCalls;
  PyObject *variants;
  PyObject *haplotypes;
  PyObject *genotypes;
  double **genotypeLikelihoods;
  double **goodnessOfFitValues;
  double **EMLikelihoods;
  double *frequencies;
  double *newFrequencies;
  int **haplotypeIndexes;
  int *nReads;
  double *maxLogLikelihoods;
  double *freqsPrimeByHapIndex;
  int nVariants;
  int nHaplotypes;
  int nIndividuals;
  int maxHaplotypes;
  int maxGenotypes;
  int nGenotypes;
  int verbosity;
  int useEMLikelihoods;
  PyObject *readBuffers;
  struct __pyx_obj_9fastafile_FastaFile *refFile;
  PyObject *options;
};


/* "chaplotype.pxd":14
 * 
 * @cython.final
 * cdef class Haplotype:             # <<<<<<<<<<<<<<
 *     cdef:
 *         bytes refName
 */
struct __pyx_obj_10chaplotype_Haplotype {
  PyObject_HEAD
  struct __pyx_vtabstruct_10chaplotype_Haplotype *__pyx_vtab;
  PyObject *refName;
  int startPos;
  int endPos;
  int maxReadLength;
  int minVarPos;
  int maxVarPos;
  PyObject *variants;
  PyObject *haplotypeSequence;
  PyObject *shortHaplotypeSequence;
  char *cHaplotypeSequence;
  struct __pyx_obj_9fastafile_FastaFile *refFile;
  PyObject *options;
  double *likelihoodCache;
  int lenCache;
  int lastIndividualIndex;
  PyObject *referenceSequence;
  PyObject *shortReferenceSequence;
  struct __pyx_obj_7variant_Variant *longVar;
  int hash;
  int hapLen;
  int verbosity;
  int endBufferSize;
  char *cHomopolQ;
  char *localGapOpen;
  short *hapSequenceHash;
  short *hapSequenceNextArray;
  int *mapCounts;
  int mapCountsLen;
};


/* "cgenotype.pxd":9
 * 
 * @cython.final
 * cdef class DiploidGenotype:             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap1
 *     cdef Haplotype hap2
 */
struct __pyx_obj_9cgenotype_DiploidGenotype {
  PyObject_HEAD
  struct __pyx_vtabstruct_9cgenotype_DiploidGenotype *__pyx_vtab;
  struct __pyx_obj_10chaplotype_Haplotype *hap1;
  struct __pyx_obj_10chaplotype_Haplotype *hap2;
  double hap1Like;
  double hap2Like;
};


/* "cgenotype.pxd":17
 * 
 * @cython.final
 * cdef class HaploidGenotype:             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap1
 *     cdef double calculateDataLikelihood(self, cAlignedRead** start, cAlignedRead** end, int individualIndex, int nIndividuals)
 */
struct __pyx_obj_9cgenotype_HaploidGenotype {
  PyObject_HEAD
  struct __pyx_vtabstruct_9cgenotype_HaploidGenotype *__pyx_vtab;
  struct __pyx_obj_10chaplotype_Haplotype *hap1;
};



/* "fastafile.pxd":1
 * cdef class FastaIndex:             # <<<<<<<<<<<<<<
 *     cdef object theFile
 *     cdef dict getRefs(self, int parseNCBI)
 */

struct __pyx_vtabstruct_9fastafile_FastaIndex {
  PyObject *(*getRefs)(struct __pyx_obj_9fastafile_FastaIndex *, int);
};
static struct __pyx_vtabstruct_9fastafile_FastaIndex *__pyx_vtabptr_9fastafile_FastaIndex;


/* "fastafile.pxd":5
 *     cdef dict getRefs(self, int parseNCBI)
 * 
 * cdef class FastaFile(object):             # <<<<<<<<<<<<<<
 *     cdef object theFile
 *     cdef FastaIndex theIndex
 */

struct __pyx_vtabstruct_9fastafile_FastaFile {
  PyObject *(*getCharacter)(struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PY_LONG_LONG);
  PyObject *(*getSequence)(struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PY_LONG_LONG, PY_LONG_LONG);
  void (*setCacheSequence)(struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PY_LONG_LONG, PY_LONG_LONG);
};
static struct __pyx_vtabstruct_9fastafile_FastaFile *__pyx_vtabptr_9fastafile_FastaFile;


/* "htslibWrapper.pxd":203
 *     unsigned char mapq
 * 
 * cdef class Samfile:             # <<<<<<<<<<<<<<
 *     cdef void clearHeader(self)
 *     cdef void clearIndex(self)
 */

struct __pyx_vtabstruct_13htslibWrapper_Samfile {
  void (*clearHeader)(struct __pyx_obj_13htslibWrapper_Samfile *);
  void (*clearIndex)(struct __pyx_obj_13htslibWrapper_Samfile *);
  int (*_isBam)(struct __pyx_obj_13htslibWrapper_Samfile *);
  int (*_isCram)(struct __pyx_obj_13htslibWrapper_Samfile *);
  int (*_isOpen)(struct __pyx_obj_13htslibWrapper_Samfile *);
  PyObject *(*_hasIndex)(struct __pyx_obj_13htslibWrapper_Samfile *);
  void (*openBAMFile)(struct __pyx_obj_13htslibWrapper_Samfile *, PyObject *);
  PyObject *(*_open)(struct __pyx_obj_13htslibWrapper_Samfile *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_13htslibWrapper_7Samfile__open *__pyx_optional_args);
  char *(*getrname)(struct __pyx_obj_13htslibWrapper_Samfile *, int);
  struct __pyx_obj_13htslibWrapper_ReadIterator *(*fetch)(struct __pyx_obj_13htslibWrapper_Samfile *, char const *, int __pyx_skip_dispatch);
  PyObject *(*close)(struct __pyx_obj_13htslibWrapper_Samfile *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_13htslibWrapper_Samfile *__pyx_vtabptr_13htslibWrapper_Samfile;


/* "htslibWrapper.pxd":222
 *     cdef object lock
 * 
 * cdef class ReadIterator:             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead* get(self, int storeRgID, char** rgID)
 *     cdef int cnext(self) nogil
 */

struct __pyx_vtabstruct_13htslibWrapper_ReadIterator {
  __pyx_t_13htslibWrapper_cAlignedRead *(*get)(struct __pyx_obj_13htslibWrapper_ReadIterator *, int, char **);
  int (*cnext)(struct __pyx_obj_13htslibWrapper_ReadIterator *);
  char (*_getBase)(struct __pyx_obj_13htslibWrapper_ReadIterator *, uint8_t *, int);
};
static struct __pyx_vtabstruct_13htslibWrapper_ReadIterator *__pyx_vtabptr_13htslibWrapper_ReadIterator;


/* "variant.pxd":17
 * 
 * @cython.final
 * cdef class Variant:             # <<<<<<<<<<<<<<
 *     cdef:
 *         public bytes refName
 */

struct __pyx_vtabstruct_7variant_Variant {
  double (*indelPrior)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_9fastafile_FastaFile *, int);
  double (*calculatePrior)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_9fastafile_FastaFile *);
  void (*addVariant)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_7variant_Variant *);
  int (*overlaps)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_7variant_Variant *);
};
static struct __pyx_vtabstruct_7variant_Variant *__pyx_vtabptr_7variant_Variant;


/* "variant.pxd":44
 * 
 * @cython.final
 * cdef class VariantCandidateGenerator:             # <<<<<<<<<<<<<<
 *     cdef int CIGAR_M
 *     cdef int CIGAR_I
 */

struct __pyx_vtabstruct_7variant_VariantCandidateGenerator {
  void (*addVariantToList)(struct __pyx_obj_7variant_VariantCandidateGenerator *, struct __pyx_obj_7variant_Variant *);
  void (*getSnpCandidatesFromReadSegment)(struct __pyx_obj_7variant_VariantCandidateGenerator *, __pyx_t_13htslibWrapper_cAlignedRead *, char *, char *, int, int, int, int, int);
  void (*getVariantCandidatesFromSingleRead)(struct __pyx_obj_7variant_VariantCandidateGenerator *, __pyx_t_13htslibWrapper_cAlignedRead *);
  void (*addCandidatesFromReads)(struct __pyx_obj_7variant_VariantCandidateGenerator *, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **);
  PyObject *(*getCandidates)(struct __pyx_obj_7variant_VariantCandidateGenerator *, int);
};
static struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *__pyx_vtabptr_7variant_VariantCandidateGenerator;


/* "cwindow.pxd":13
 * ###################################################################################################
 * 
 * cdef class ReadArray:             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead** array
 *     cdef cAlignedRead** windowStart
 */

struct __pyx_vtabstruct_7cwindow_ReadArray {
  int (*getSize)(struct __pyx_obj_7cwindow_ReadArray *);
  void (*append)(struct __pyx_obj_7cwindow_ReadArray *, __pyx_t_13htslibWrapper_cAlignedRead *);
  void (*setWindowPointers)(struct __pyx_obj_7cwindow_ReadArray *, int, int);
  void (*setWindowPointersBasedOnMatePos)(struct __pyx_obj_7cwindow_ReadArray *, int, int);
  int (*getLengthOfLongestRead)(struct __pyx_obj_7cwindow_ReadArray *);
  int (*countReadsCoveringRegion)(struct __pyx_obj_7cwindow_ReadArray *, int, int);
};
static struct __pyx_vtabstruct_7cwindow_ReadArray *__pyx_vtabptr_7cwindow_ReadArray;


/* "cwindow.pxd":29
 * ###################################################################################################
 * 
 * cdef class bamReadBuffer:             # <<<<<<<<<<<<<<
 *     cdef char* chrom
 *     cdef int chromID
 */

struct __pyx_vtabstruct_7cwindow_bamReadBuffer {
  void (*setWindowPointers)(struct __pyx_obj_7cwindow_bamReadBuffer *, int, int, int, int, char *, int);
  void (*recompressReadsInCurrentWindow)(struct __pyx_obj_7cwindow_bamReadBuffer *, int, int, char *, int, int);
  void (*addReadToBuffer)(struct __pyx_obj_7cwindow_bamReadBuffer *, __pyx_t_13htslibWrapper_cAlignedRead *);
  int (*countImproperPairs)(struct __pyx_obj_7cwindow_bamReadBuffer *);
  int (*countAlignmentGaps)(struct __pyx_obj_7cwindow_bamReadBuffer *);
  void (*sortReads)(struct __pyx_obj_7cwindow_bamReadBuffer *);
  void (*sortBrokenMates)(struct __pyx_obj_7cwindow_bamReadBuffer *);
  void (*logFilterSummary)(struct __pyx_obj_7cwindow_bamReadBuffer *);
  int (*countReadsCoveringRegion)(struct __pyx_obj_7cwindow_bamReadBuffer *, int, int);
};
static struct __pyx_vtabstruct_7cwindow_bamReadBuffer *__pyx_vtabptr_7cwindow_bamReadBuffer;


/* "cpopulation.pxd":12
 * ###################################################################################################
 * 
 * cdef class Population:             # <<<<<<<<<<<<<<
 * 
 *     # Class variables
 */

struct __pyx_vtabstruct_11cpopulation_Population {
  double (*calculatePosterior)(struct __pyx_obj_11cpopulation_Population *, struct __pyx_obj_7variant_Variant *, struct __pyx_opt_args_11cpopulation_10Population_calculatePosterior *__pyx_optional_args);
  void (*computeVariantPosteriors)(struct __pyx_obj_11cpopulation_Population *);
  void (*computeVariantINFO)(struct __pyx_obj_11cpopulation_Population *);
  void (*reset)(struct __pyx_obj_11cpopulation_Population *);
  void (*computeVariantFILTER)(struct __pyx_obj_11cpopulation_Population *);
  void (*callGenotypes)(struct __pyx_obj_11cpopulation_Population *);
  void (*call)(struct __pyx_obj_11cpopulation_Population *, int, int);
  double (*EMiteration)(struct __pyx_obj_11cpopulation_Population *, double *, double *);
  void (*setup)(struct __pyx_obj_11cpopulation_Population *, PyObject *, PyObject *, PyObject *, int, int, PyObject *);
};
static struct __pyx_vtabstruct_11cpopulation_Population *__pyx_vtabptr_11cpopulation_Population;


/* "chaplotype.pxd":14
 * 
 * @cython.final
 * cdef class Haplotype:             # <<<<<<<<<<<<<<
 *     cdef:
 *         bytes refName
 */

struct __pyx_vtabstruct_10chaplotype_Haplotype {
  double *(*alignReads)(struct __pyx_obj_10chaplotype_Haplotype *, int, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, int);
  double (*alignSingleRead)(struct __pyx_obj_10chaplotype_Haplotype *, __pyx_t_13htslibWrapper_cAlignedRead *, int);
  char *(*getReferenceSequence)(struct __pyx_obj_10chaplotype_Haplotype *, struct __pyx_opt_args_10chaplotype_9Haplotype_getReferenceSequence *__pyx_optional_args);
  char *(*getMutatedSequence)(struct __pyx_obj_10chaplotype_Haplotype *);
  char *(*getShortHaplotypeSequence)(struct __pyx_obj_10chaplotype_Haplotype *);
  PyObject *(*vcfINFO)(struct __pyx_obj_10chaplotype_Haplotype *);
  PyObject *(*getSequenceContext)(struct __pyx_obj_10chaplotype_Haplotype *, struct __pyx_obj_7variant_Variant *);
  int (*homopolymerLengthForOneVariant)(struct __pyx_obj_10chaplotype_Haplotype *, struct __pyx_obj_7variant_Variant *);
  PyObject *(*homopolymerLengths)(struct __pyx_obj_10chaplotype_Haplotype *);
  void (*annotateWithGapOpen)(struct __pyx_obj_10chaplotype_Haplotype *);
};
static struct __pyx_vtabstruct_10chaplotype_Haplotype *__pyx_vtabptr_10chaplotype_Haplotype;


/* "cgenotype.pxd":9
 * 
 * @cython.final
 * cdef class DiploidGenotype:             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap1
 *     cdef Haplotype hap2
 */

struct __pyx_vtabstruct_9cgenotype_DiploidGenotype {
  double (*calculateDataLikelihood)(struct __pyx_obj_9cgenotype_DiploidGenotype *, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, int, int, double *, int);
};
static struct __pyx_vtabstruct_9cgenotype_DiploidGenotype *__pyx_vtabptr_9cgenotype_DiploidGenotype;


/* "cgenotype.pxd":17
 * 
 * @cython.final
 * cdef class HaploidGenotype:             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap1
 *     cdef double calculateDataLikelihood(self, cAlignedRead** start, cAlignedRead** end, int individualIndex, int nIndividuals)
 */

struct __pyx_vtabstruct_9cgenotype_HaploidGenotype {
  double (*calculateDataLikelihood)(struct __pyx_obj_9cgenotype_HaploidGenotype *, __pyx_t_13htslibWrapper_cAlignedRead **, __pyx_t_13htslibWrapper_cAlignedRead **, int, int);
};
static struct __pyx_vtabstruct_9cgenotype_HaploidGenotype *__pyx_vtabptr_9cgenotype_HaploidGenotype;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#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);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

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

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

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

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

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

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

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

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_FloorDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceFloorDivide(op1, op2) : PyNumber_FloorDivide(op1, op2))
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    (likely((cfunc)->func) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (PY_VERSION_HEX >= 0x030600B1 && likely((cfunc)->flag == METH_FASTCALL) ?\
            (PY_VERSION_HEX >= 0x030700A0 ?\
                (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0) :\
                (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL)) :\
          (PY_VERSION_HEX >= 0x030700A0 && (cfunc)->flag == (METH_FASTCALL | METH_KEYWORDS) ?\
            (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, &__pyx_empty_tuple, 0, NULL) :\
            (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(void*)(PyCFunction)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
               ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) :\
               __Pyx__CallUnboundCMethod0(cfunc, self)))))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* StringJoin.proto */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* RaiseArgTupleInvalid.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);

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

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

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_SubtractCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyIntFromDouble.proto */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
#else
#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
#endif

/* IncludeStringH.proto */
#include <string.h>

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

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

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

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
#endif

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* GetVTable.proto */
static void* __Pyx_GetVtable(PyObject *dict);

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

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

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* VoidPtrImport.proto */
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);

/* FunctionImport.proto */
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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


/* Module declarations from 'cython' */

/* Module declarations from 'fastafile' */
static PyTypeObject *__pyx_ptype_9fastafile_FastaIndex = 0;
static PyTypeObject *__pyx_ptype_9fastafile_FastaFile = 0;

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'htslibWrapper' */
static PyTypeObject *__pyx_ptype_13htslibWrapper_Samfile = 0;
static PyTypeObject *__pyx_ptype_13htslibWrapper_ReadIterator = 0;

/* Module declarations from 'variant' */
static PyTypeObject *__pyx_ptype_7variant_Variant = 0;
static PyTypeObject *__pyx_ptype_7variant_VariantCandidateGenerator = 0;
static int *__pyx_vp_7variant_PLATYPUS_VAR = 0;
#define __pyx_v_7variant_PLATYPUS_VAR (*__pyx_vp_7variant_PLATYPUS_VAR)
static int *__pyx_vp_7variant_FILE_VAR = 0;
#define __pyx_v_7variant_FILE_VAR (*__pyx_vp_7variant_FILE_VAR)
static int *__pyx_vp_7variant_ASSEMBLER_VAR = 0;
#define __pyx_v_7variant_ASSEMBLER_VAR (*__pyx_vp_7variant_ASSEMBLER_VAR)

/* Module declarations from 'platypusutils' */
static double (*__pyx_f_13platypusutils_betaBinomialCDF)(int, int, int, int); /*proto*/
static PyObject *(*__pyx_f_13platypusutils_loadBAMData)(PyObject *, PyObject *, int, int, PyObject *, PyObject *, PyObject *, PyObject *, char *); /*proto*/
static struct __pyx_obj_7variant_Variant *(*__pyx_f_13platypusutils_leftNormaliseIndel)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_9fastafile_FastaFile *, int); /*proto*/

/* Module declarations from 'cwindow' */
static PyTypeObject *__pyx_ptype_7cwindow_ReadArray = 0;
static PyTypeObject *__pyx_ptype_7cwindow_bamReadBuffer = 0;

/* Module declarations from 'cpopulation' */
static PyTypeObject *__pyx_ptype_11cpopulation_Population = 0;

/* Module declarations from 'chaplotype' */
static PyTypeObject *__pyx_ptype_10chaplotype_Haplotype = 0;

/* Module declarations from 'vcfutils' */
static void (*__pyx_f_8vcfutils_outputCallToVCF)(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, double *, double **, double **, int **, PyObject *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, int, int); /*proto*/
static PyObject *(*__pyx_f_8vcfutils_refAndAlt)(char *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *); /*proto*/
static void (*__pyx_f_8vcfutils_outputHLACallToVCF)(PyObject *, PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, int, int); /*proto*/

/* Module declarations from 'variantFilter' */
static PyObject *(*__pyx_f_13variantFilter_filterVariants)(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, int, int, int, int, PyObject *); /*proto*/
static void (*__pyx_f_13variantFilter_filterVariantsInWindow)(PyObject *, PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *); /*proto*/
static void (*__pyx_f_13variantFilter_filterVariantsByCoverage)(PyObject *, PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_13variantFilter_getHaplotypesInWindow)(PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, int, int, int, int, int, int, int, PyObject *, PyObject *); /*proto*/
static PyObject *(*__pyx_f_13variantFilter_padVariants)(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *); /*proto*/
static double (*__pyx_f_13variantFilter_computeVariantReadSupportFrac)(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_7cwindow_bamReadBuffer *); /*proto*/
static PyObject *(*__pyx_f_13variantFilter_getAllHLAHaplotypesInRegion)(PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *); /*proto*/
static struct __pyx_obj_7variant_Variant *(*__pyx_f_13variantFilter_normaliseVar)(struct __pyx_obj_7variant_Variant *); /*proto*/
static struct __pyx_obj_7variant_Variant *(*__pyx_f_13variantFilter_trimLongVar)(struct __pyx_obj_7variant_Variant *, int, int); /*proto*/
static PyObject *(*__pyx_f_13variantFilter_getAllAssemblerHaplotypesInRegion)(PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *); /*proto*/

/* Module declarations from 'cgenotype' */
static PyTypeObject *__pyx_ptype_9cgenotype_DiploidGenotype = 0;
static PyTypeObject *__pyx_ptype_9cgenotype_HaploidGenotype = 0;
static PyObject *(*__pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList)(PyObject *); /*proto*/

/* Module declarations from 'assembler' */
static PyObject *(*__pyx_f_9assembler_assembleReadsAndDetectVariants)(char *, int, int, int, int, PyObject *, char *, PyObject *); /*proto*/

/* Module declarations from 'variantcaller' */
static void __pyx_f_13variantcaller_callVariantsInWindow(PyObject *, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, struct __pyx_obj_11cpopulation_Population *, int, int, char *); /*proto*/
static PyObject *__pyx_f_13variantcaller_callHLAVariantsInWindow(PyObject *, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, struct __pyx_obj_11cpopulation_Population *, int, int, char *); /*proto*/
static int __pyx_f_13variantcaller_doWeNeedToAssembleThisRegion(PyObject *, PyObject *, int, int, PyObject *, char *); /*proto*/
static PyObject *__pyx_f_13variantcaller_mergeHaplotypes(PyObject *, struct __pyx_obj_9fastafile_FastaFile *); /*proto*/
static PyObject *__pyx_f_13variantcaller_generateVariantsInRegion(PyObject *, int, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
static void __pyx_f_13variantcaller_callVariantsInRegion(PyObject *, int, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_11cpopulation_Population *); /*proto*/
static void __pyx_f_13variantcaller_callHLAVariantsInRegion(PyObject *, int, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_obj_11cpopulation_Population *); /*proto*/
#define __Pyx_MODULE_NAME "variantcaller"
extern int __pyx_module_is_main_variantcaller;
int __pyx_module_is_main_variantcaller = 0;

/* Implementation of 'variantcaller' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_StandardError;
static PyObject *__pyx_builtin_open;
static const char __pyx_k_[] = "\t";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_s[] = "%s\n";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_FR[] = "FR";
static const char __pyx_k_FS[] = "FS";
static const char __pyx_k_GL[] = "GL";
static const char __pyx_k_GQ[] = "GQ";
static const char __pyx_k_GT[] = "GT";
static const char __pyx_k_HP[] = "HP";
static const char __pyx_k_MQ[] = "MQ";
static const char __pyx_k_NF[] = "NF";
static const char __pyx_k_NR[] = "NR";
static const char __pyx_k_NV[] = "NV";
static const char __pyx_k_PP[] = "PP";
static const char __pyx_k_QD[] = "QD";
static const char __pyx_k_SC[] = "SC";
static const char __pyx_k_TC[] = "TC";
static const char __pyx_k_TR[] = "TR";
static const char __pyx_k_WE[] = ";WE=";
static const char __pyx_k_WS[] = "WS=";
static const char __pyx_k__2[] = ".";
static const char __pyx_k__3[] = ":";
static const char __pyx_k__4[] = "/";
static const char __pyx_k__6[] = "-";
static const char __pyx_k__7[] = "";
static const char __pyx_k_fo[] = "fo";
static const char __pyx_k_gz[] = ".gz";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_0_0[] = "0/0";
static const char __pyx_k_100[] = "100";
static const char __pyx_k_BRF[] = "BRF";
static const char __pyx_k_END[] = "END";
static const char __pyx_k_GOF[] = "GOF";
static const char __pyx_k_Log[] = "Log";
static const char __pyx_k_TCF[] = "TCF";
static const char __pyx_k_TCR[] = "TCR";
static const char __pyx_k_VCF[] = "VCF";
static const char __pyx_k_alt[] = "alt";
static const char __pyx_k_bam[] = ".bam";
static const char __pyx_k_bgz[] = ".bgz";
static const char __pyx_k_bz2[] = ".bz2";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_fai[] = ".fai";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_run[] = "run";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_vcf[] = "vcf";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_MGOF[] = "MGOF";
static const char __pyx_k_MMLQ[] = "MMLQ";
static const char __pyx_k_Open[] = "Open";
static const char __pyx_k_Size[] = ";Size=";
static const char __pyx_k_WE_2[] = "WE";
static const char __pyx_k_WS_2[] = "WS";
static const char __pyx_k_cram[] = ".cram";
static const char __pyx_k_date[] = "date";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_nInd[] = "nInd";
static const char __pyx_k_nVar[] = "nVar";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_qual[] = "qual";
static const char __pyx_k_rlen[] = "rlen";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_0_0_2[] = "0.0";
static const char __pyx_k_START[] = "START";
static const char __pyx_k_chrom[] = "chrom";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_SbPval[] = "SbPval";
static const char __pyx_k_Size_2[] = "Size";
static const char __pyx_k_Source[] = "Source";
static const char __pyx_k_bisect[] = "bisect";
static const char __pyx_k_endPos[] = "endPos";
static const char __pyx_k_filter[] = "filter";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_minCov[] = "minCov";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_source[] = "source";
static const char __pyx_k_stdout[] = "stdout";
static const char __pyx_k_window[] = "window";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_Process[] = "Process";
static const char __pyx_k_REFCALL[] = "REFCALL";
static const char __pyx_k_genSNPs[] = "genSNPs";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_maxPost[] = "maxPost";
static const char __pyx_k_maxSize[] = "maxSize";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_probRef[] = "probRef";
static const char __pyx_k_refFile[] = "refFile";
static const char __pyx_k_regions[] = "regions";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_setinfo[] = "setinfo";
static const char __pyx_k_theLock[] = "theLock";
static const char __pyx_k_vcfFile[] = "vcfFile";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_HapScore[] = "HapScore";
static const char __pyx_k_Variants[] = "Variants";
static const char __pyx_k_assemble[] = "assemble";
static const char __pyx_k_bamFiles[] = "bamFiles";
static const char __pyx_k_datetime[] = "datetime";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_fileDate[] = "fileDate";
static const char __pyx_k_fileName[] = "fileName";
static const char __pyx_k_lineinfo[] = "lineinfo";
static const char __pyx_k_maxReads[] = "maxReads";
static const char __pyx_k_minFlank[] = "minFlank";
static const char __pyx_k_minReads[] = "minReads";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_readSize[] = "readSize";
static const char __pyx_k_startPos[] = "startPos";
static const char __pyx_k_theLocks[] = "theLocks";
static const char __pyx_k_theStart[] = "theStart";
static const char __pyx_k_variants[] = "variants";
static const char __pyx_k_vcfutils[] = "vcfutils";
static const char __pyx_k_HLATyping[] = "HLATyping";
static const char __pyx_k_SeqLength[] = "SeqLength";
static const char __pyx_k_cigarSize[] = "cigarSize";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_exception[] = "exception";
static const char __pyx_k_genIndels[] = "genIndels";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_maxRefPos[] = "maxRefPos";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_minRefPos[] = "minRefPos";
static const char __pyx_k_setfilter[] = "setfilter";
static const char __pyx_k_setformat[] = "setformat";
static const char __pyx_k_setheader[] = "setheader";
static const char __pyx_k_theBuffer[] = "theBuffer";
static const char __pyx_k_theFormat[] = "theFormat";
static const char __pyx_k_totalSize[] = "totalSize";
static const char __pyx_k_vcfHeader[] = "vcfHeader";
static const char __pyx_k_verbosity[] = "verbosity";
static const char __pyx_k_windowEnd[] = "windowEnd";
static const char __pyx_k_bufferSize[] = "bufferSize";
static const char __pyx_k_chaplotype[] = "chaplotype";
static const char __pyx_k_chromosome[] = "chromosome";
static const char __pyx_k_continuing[] = "continuing";
static const char __pyx_k_linefilter[] = "linefilter";
static const char __pyx_k_maxProbVar[] = "maxProbVar";
static const char __pyx_k_minMapQual[] = "minMapQual";
static const char __pyx_k_minVarFreq[] = "minVarFreq";
static const char __pyx_k_outputFile[] = "outputFile";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_setsamples[] = "setsamples";
static const char __pyx_k_sourceFile[] = "sourceFile";
static const char __pyx_k_theBamFile[] = "theBamFile";
static const char __pyx_k_thisSample[] = "thisSample";
static const char __pyx_k_totalReads[] = "totalReads";
static const char __pyx_k_windowSize[] = "windowSize";
static const char __pyx_k_write_data[] = "write_data";
static const char __pyx_k_assembleAll[] = "assembleAll";
static const char __pyx_k_granularity[] = "granularity";
static const char __pyx_k_isBamOrCram[] = "isBamOrCram";
static const char __pyx_k_maxVariants[] = "maxVariants";
static const char __pyx_k_minBaseQual[] = "minBaseQual";
static const char __pyx_k_phredPValue[] = "phredPValue";
static const char __pyx_k_pointerSize[] = "pointerSize";
static const char __pyx_k_qualBinSize[] = "qualBinSize";
static const char __pyx_k_readBuffers[] = "readBuffers";
static const char __pyx_k_samplesByID[] = "samplesByID";
static const char __pyx_k_seqQualSize[] = "seqQualSize";
static const char __pyx_k_vcfDataLine[] = "vcfDataLine";
static const char __pyx_k_windowIndex[] = "windowIndex";
static const char __pyx_k_windowStart[] = "windowStart";
static const char __pyx_k_writeheader[] = "writeheader";
static const char __pyx_k_bamFileNames[] = "bamFileNames";
static const char __pyx_k_maxGenotypes[] = "maxGenotypes";
static const char __pyx_k_nIndividuals[] = "nIndividuals";
static const char __pyx_k_samplesByBAM[] = "samplesByBAM";
static const char __pyx_k_variantutils[] = "variantutils";
static const char __pyx_k_Haplotype_d_s[] = "Haplotype %d: %s";
static const char __pyx_k_StandardError[] = "StandardError";
static const char __pyx_k_compressReads[] = "compressReads";
static const char __pyx_k_fromtimestamp[] = "fromtimestamp";
static const char __pyx_k_maxHaplotypes[] = "maxHaplotypes";
static const char __pyx_k_outputRefCall[] = "outputRefCall";
static const char __pyx_k_platypusutils[] = "platypusutils";
static const char __pyx_k_singleProcess[] = "singleProcess";
static const char __pyx_k_theReadBuffer[] = "theReadBuffer";
static const char __pyx_k_variantcaller[] = "variantcaller";
static const char __pyx_k_ReadPosRankSum[] = "ReadPosRankSum";
static const char __pyx_k_alignScoreFile[] = "alignScoreFile";
static const char __pyx_k_outputRefCalls[] = "outputRefCalls";
static const char __pyx_k_thisBufferSize[] = "thisBufferSize";
static const char __pyx_k_Max_genotypes_s[] = "Max genotypes = %s";
static const char __pyx_k_WindowGenerator[] = "WindowGenerator";
static const char __pyx_k_multiprocessing[] = "multiprocessing";
static const char __pyx_k_platypusOptions[] = "platypusOptions";
static const char __pyx_k_totalBufferSize[] = "totalBufferSize";
static const char __pyx_k_windowGenerator[] = "windowGenerator";
static const char __pyx_k_GT_GL_NR_NV1_NV2[] = "GT:GL:NR:NV1:NV2";
static const char __pyx_k_PLATYPUS_VERSION[] = "PLATYPUS_VERSION";
static const char __pyx_k_refCallBlockSize[] = "refCallBlockSize";
static const char __pyx_k_totalSeqQualSize[] = "totalSeqQualSize";
static const char __pyx_k_vcfInfoSignature[] = "vcfInfoSignature";
static const char __pyx_k_assemblerKmerSize[] = "assemblerKmerSize";
static const char __pyx_k_thisBadBufferSize[] = "thisBadBufferSize";
static const char __pyx_k_GT_GL_GOF_GQ_NR_NV[] = "GT:GL:GOF:GQ:NR:NV";
static const char __pyx_k_WindowsAndVariants[] = "WindowsAndVariants";
static const char __pyx_k_assemblyRegionSize[] = "assemblyRegionSize";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_vcfFilterSignature[] = "vcfFilterSignature";
static const char __pyx_k_vcfFormatSignature[] = "vcfFormatSignature";
static const char __pyx_k_Platypus_Version__s[] = "Platypus_Version_%s";
static const char __pyx_k_getVariantsFromBAMs[] = "getVariantsFromBAMs";
static const char __pyx_k_Alignment_score_File[] = "#Alignment score File\n";
static const char __pyx_k_PlatypusMultiProcess[] = "PlatypusMultiProcess";
static const char __pyx_k_filterVarsByCoverage[] = "filterVarsByCoverage";
static const char __pyx_k_skipDifficultWindows[] = "skipDifficultWindows";
static const char __pyx_k_PlatypusSingleProcess[] = "PlatypusSingleProcess";
static const char __pyx_k_originalMaxHaplotypes[] = "originalMaxHaplotypes";
static const char __pyx_k_VariantCandidateReader[] = "VariantCandidateReader";
static const char __pyx_k_Processing_region_s_s_s[] = "Processing region %s:%s-%s";
static const char __pyx_k_Processing_window_s_s_s[] = "Processing window %s:%s-%s";
static const char __pyx_k_countTotalReadsInRegion[] = "countTotalReadsInRegion";
static const char __pyx_k_start_end_of_region_d_d[] = "start - end of region %d - %d";
static const char __pyx_k_PlatypusMultiProcess_run[] = "PlatypusMultiProcess.run";
static const char __pyx_k_cython_variantcaller_pyx[] = "cython/variantcaller.pyx";
static const char __pyx_k_In_HLA_variant_window_d_d[] = "In HLA variant window %d %d";
static const char __pyx_k_PlatypusSingleProcess_run[] = "PlatypusSingleProcess.run";
static const char __pyx_k_Merging_haplotypes_s_and_s[] = "Merging haplotypes %s and %s";
static const char __pyx_k_PlatypusMultiProcess___init[] = "PlatypusMultiProcess.__init__";
static const char __pyx_k_getBAMFileNamesFromTextFile[] = "getBAMFileNamesFromTextFile";
static const char __pyx_k_Opening_file_s_for_appending[] = "Opening file %s for appending";
static const char __pyx_k_PlatypusSingleProcess___init[] = "PlatypusSingleProcess.__init__";
static const char __pyx_k_Region_s_s_s_will_be_skipped[] = "Region %s:%s-%s will be skipped";
static const char __pyx_k_Window_s_s_s_will_be_skipped[] = "Window %s:%s-%s will be skipped";
static const char __pyx_k_nCombinationsWithReplacement[] = "nCombinationsWithReplacement";
static const char __pyx_k_getSampleNamesAndLoadIterators[] = "getSampleNamesAndLoadIterators";
static const char __pyx_k_Assembly_region_windows_will_be[] = "Assembly region windows will be tiled. Each region will start %s bases after the last one";
static const char __pyx_k_Exception_in_region_s_s_s_Error[] = "Exception in region %s:%s-%s. Error was %s";
static const char __pyx_k_Max_haplotypes_used_for_initial[] = "Max haplotypes used for initial haplotype filtering = %s";
static const char __pyx_k_Need_to_assemble_s_s_s_nReads_s[] = "Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s";
static const char __pyx_k_Simple_class_to_represent_a_sin[] = "\n    Simple class to represent a single Platypus process.\n    ";
static const char __pyx_k_Skipping_window_with_s_variants[] = "Skipping window with %s variants";
static const char __pyx_k_There_are_s_reads_buffer_size_s[] = "There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s";
static const char __pyx_k_This_module_contains_the_top_le[] = "\nThis module contains the top-level variant-calling\ncode, including a VariantCaller class.\n";
static const char __pyx_k_Treating_bamFiles_argument_s_as[] = "Treating --bamFiles argument, %s as a text file containing a list of BAM file names";
static const char __pyx_k_But_keep_maxSize_below_5000_othe[] = "But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes";
static const char __pyx_k_Exception_in_window_d_d_Error_wa[] = "Exception in window %d-%d. Error was %s";
static const char __pyx_k_Found_very_long_read_s_bases_Cap[] = "Found very long read (%s bases). Capping max read length at --maxSize (%s).";
static const char __pyx_k_Increase_maxSize_if_you_want_lon[] = "Increase --maxSize if you want longer reads to be used for determining widow boundaries";
static const char __pyx_k_Invalid_reference_FASTA_file_sup[] = "Invalid reference FASTA file supplied";
static const char __pyx_k_Longer_reads_will_be_used_for_al[] = "Longer reads will be used for alignments but not to determine window boundaries";
static const char __pyx_k_Max_haplotypes_used_for_genotype[] = "Max haplotypes used for genotype generation = %s";
static const char __pyx_k_No_coverage_in_window_s_s_s_Skip[] = "No coverage in window %s:%s-%s. Skipping";
static const char __pyx_k_Processed_sample_s_Detected_s_un[] = "Processed sample %s. Detected %s unfiltered variant candidates so far";
static const char __pyx_k_Processing_region_s_s_s_Only_pri[] = "Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)";
static const char __pyx_k_Reference_file_name_s_looks_like[] = "Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus";
static const char __pyx_k_Searching_for_variants_in_the_fo[] = "Searching for variants in the following regions: %s";
static const char __pyx_k_Sizes_SeqQual_s_cigar_s_read_s_p[] = "Sizes: SeqQual = %s. cigar = %s. read = %s. pointers = %s. Total = %s";
static const char __pyx_k_Skipping_pathalogical_window_s_s[] = "Skipping pathalogical window %s:%s-%s with %s reads";
static const char __pyx_k_Skipping_region_s_s_s_as_data_co[] = "Skipping region %s:%s-%s as data could not be loaded";
static const char __pyx_k_Skipping_very_large_window_s_s_s[] = "Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)";
static const char __pyx_k_There_are_s_filtered_variant_can[] = "There are %s filtered variant candidates in reads which overlap the region %s:%s-%s";
static const char __pyx_k_This_reduces_to_s_candidates_aft[] = "This reduces to %s candidates after coverage-filtering";
static const char __pyx_k_Need_to_assemble_s_s_s_nReads_s_2[] = "Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s";
static const char __pyx_k_Simple_class_to_represent_a_sin_2[] = "\n    Simple class to represent a single Platypus process, which is run as part of a\n    multi-process job.\n    ";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_kp_s_0_0;
static PyObject *__pyx_kp_s_0_0_2;
static PyObject *__pyx_kp_s_100;
static PyObject *__pyx_kp_s_Alignment_score_File;
static PyObject *__pyx_kp_s_Assembly_region_windows_will_be;
static PyObject *__pyx_n_s_BRF;
static PyObject *__pyx_kp_s_But_keep_maxSize_below_5000_othe;
static PyObject *__pyx_n_s_END;
static PyObject *__pyx_kp_s_Exception_in_region_s_s_s_Error;
static PyObject *__pyx_kp_s_Exception_in_window_d_d_Error_wa;
static PyObject *__pyx_n_s_FR;
static PyObject *__pyx_n_s_FS;
static PyObject *__pyx_kp_s_Found_very_long_read_s_bases_Cap;
static PyObject *__pyx_n_s_GL;
static PyObject *__pyx_n_s_GOF;
static PyObject *__pyx_n_s_GQ;
static PyObject *__pyx_n_s_GT;
static PyObject *__pyx_kp_s_GT_GL_GOF_GQ_NR_NV;
static PyObject *__pyx_kp_s_GT_GL_NR_NV1_NV2;
static PyObject *__pyx_n_s_HLATyping;
static PyObject *__pyx_n_s_HP;
static PyObject *__pyx_n_s_HapScore;
static PyObject *__pyx_kp_s_Haplotype_d_s;
static PyObject *__pyx_kp_s_In_HLA_variant_window_d_d;
static PyObject *__pyx_kp_s_Increase_maxSize_if_you_want_lon;
static PyObject *__pyx_kp_s_Invalid_reference_FASTA_file_sup;
static PyObject *__pyx_n_s_Log;
static PyObject *__pyx_kp_s_Longer_reads_will_be_used_for_al;
static PyObject *__pyx_n_s_MGOF;
static PyObject *__pyx_n_s_MMLQ;
static PyObject *__pyx_n_s_MQ;
static PyObject *__pyx_kp_s_Max_genotypes_s;
static PyObject *__pyx_kp_s_Max_haplotypes_used_for_genotype;
static PyObject *__pyx_kp_s_Max_haplotypes_used_for_initial;
static PyObject *__pyx_kp_s_Merging_haplotypes_s_and_s;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_NF;
static PyObject *__pyx_n_s_NR;
static PyObject *__pyx_n_s_NV;
static PyObject *__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s;
static PyObject *__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s_2;
static PyObject *__pyx_kp_s_No_coverage_in_window_s_s_s_Skip;
static PyObject *__pyx_n_s_Open;
static PyObject *__pyx_kp_s_Opening_file_s_for_appending;
static PyObject *__pyx_n_s_PLATYPUS_VERSION;
static PyObject *__pyx_n_s_PP;
static PyObject *__pyx_n_s_PlatypusMultiProcess;
static PyObject *__pyx_n_s_PlatypusMultiProcess___init;
static PyObject *__pyx_n_s_PlatypusMultiProcess_run;
static PyObject *__pyx_n_s_PlatypusSingleProcess;
static PyObject *__pyx_n_s_PlatypusSingleProcess___init;
static PyObject *__pyx_n_s_PlatypusSingleProcess_run;
static PyObject *__pyx_kp_s_Platypus_Version__s;
static PyObject *__pyx_n_s_Process;
static PyObject *__pyx_kp_s_Processed_sample_s_Detected_s_un;
static PyObject *__pyx_kp_s_Processing_region_s_s_s;
static PyObject *__pyx_kp_s_Processing_region_s_s_s_Only_pri;
static PyObject *__pyx_kp_s_Processing_window_s_s_s;
static PyObject *__pyx_n_s_QD;
static PyObject *__pyx_n_s_REFCALL;
static PyObject *__pyx_n_s_ReadPosRankSum;
static PyObject *__pyx_kp_s_Reference_file_name_s_looks_like;
static PyObject *__pyx_kp_s_Region_s_s_s_will_be_skipped;
static PyObject *__pyx_n_s_SC;
static PyObject *__pyx_n_s_START;
static PyObject *__pyx_n_s_SbPval;
static PyObject *__pyx_kp_s_Searching_for_variants_in_the_fo;
static PyObject *__pyx_n_s_SeqLength;
static PyObject *__pyx_kp_s_Simple_class_to_represent_a_sin;
static PyObject *__pyx_kp_s_Simple_class_to_represent_a_sin_2;
static PyObject *__pyx_kp_s_Size;
static PyObject *__pyx_n_s_Size_2;
static PyObject *__pyx_kp_s_Sizes_SeqQual_s_cigar_s_read_s_p;
static PyObject *__pyx_kp_s_Skipping_pathalogical_window_s_s;
static PyObject *__pyx_kp_s_Skipping_region_s_s_s_as_data_co;
static PyObject *__pyx_kp_s_Skipping_very_large_window_s_s_s;
static PyObject *__pyx_kp_s_Skipping_window_with_s_variants;
static PyObject *__pyx_n_s_Source;
static PyObject *__pyx_n_s_StandardError;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_TC;
static PyObject *__pyx_n_s_TCF;
static PyObject *__pyx_n_s_TCR;
static PyObject *__pyx_n_s_TR;
static PyObject *__pyx_kp_s_There_are_s_filtered_variant_can;
static PyObject *__pyx_kp_s_There_are_s_reads_buffer_size_s;
static PyObject *__pyx_kp_s_This_reduces_to_s_candidates_aft;
static PyObject *__pyx_kp_s_Treating_bamFiles_argument_s_as;
static PyObject *__pyx_n_s_VCF;
static PyObject *__pyx_n_s_VariantCandidateReader;
static PyObject *__pyx_n_s_Variants;
static PyObject *__pyx_kp_s_WE;
static PyObject *__pyx_n_s_WE_2;
static PyObject *__pyx_kp_s_WS;
static PyObject *__pyx_n_s_WS_2;
static PyObject *__pyx_n_s_WindowGenerator;
static PyObject *__pyx_kp_s_Window_s_s_s_will_be_skipped;
static PyObject *__pyx_n_s_WindowsAndVariants;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_kp_s__4;
static PyObject *__pyx_kp_s__6;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_alignScoreFile;
static PyObject *__pyx_n_s_alt;
static PyObject *__pyx_n_s_assemble;
static PyObject *__pyx_n_s_assembleAll;
static PyObject *__pyx_n_s_assemblerKmerSize;
static PyObject *__pyx_n_s_assemblyRegionSize;
static PyObject *__pyx_kp_s_bam;
static PyObject *__pyx_n_s_bamFileNames;
static PyObject *__pyx_n_s_bamFiles;
static PyObject *__pyx_kp_s_bgz;
static PyObject *__pyx_n_s_bisect;
static PyObject *__pyx_n_s_bufferSize;
static PyObject *__pyx_kp_s_bz2;
static PyObject *__pyx_n_s_chaplotype;
static PyObject *__pyx_n_s_chrom;
static PyObject *__pyx_n_s_chromosome;
static PyObject *__pyx_n_s_cigarSize;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_compressReads;
static PyObject *__pyx_n_s_continuing;
static PyObject *__pyx_n_s_countTotalReadsInRegion;
static PyObject *__pyx_kp_s_cram;
static PyObject *__pyx_kp_s_cython_variantcaller_pyx;
static PyObject *__pyx_n_s_date;
static PyObject *__pyx_n_s_datetime;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_endPos;
static PyObject *__pyx_n_s_endswith;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_exception;
static PyObject *__pyx_kp_s_fai;
static PyObject *__pyx_n_s_fileDate;
static PyObject *__pyx_n_s_fileName;
static PyObject *__pyx_n_s_filter;
static PyObject *__pyx_n_s_filterVarsByCoverage;
static PyObject *__pyx_n_s_fo;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fromtimestamp;
static PyObject *__pyx_n_s_genIndels;
static PyObject *__pyx_n_s_genSNPs;
static PyObject *__pyx_n_s_getBAMFileNamesFromTextFile;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_getSampleNamesAndLoadIterators;
static PyObject *__pyx_n_s_getVariantsFromBAMs;
static PyObject *__pyx_n_s_granularity;
static PyObject *__pyx_kp_s_gz;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_isBamOrCram;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_linefilter;
static PyObject *__pyx_n_s_lineinfo;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_maxGenotypes;
static PyObject *__pyx_n_s_maxHaplotypes;
static PyObject *__pyx_n_s_maxPost;
static PyObject *__pyx_n_s_maxProbVar;
static PyObject *__pyx_n_s_maxReads;
static PyObject *__pyx_n_s_maxRefPos;
static PyObject *__pyx_n_s_maxSize;
static PyObject *__pyx_n_s_maxVariants;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_minBaseQual;
static PyObject *__pyx_n_s_minCov;
static PyObject *__pyx_n_s_minFlank;
static PyObject *__pyx_n_s_minMapQual;
static PyObject *__pyx_n_s_minReads;
static PyObject *__pyx_n_s_minRefPos;
static PyObject *__pyx_n_s_minVarFreq;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_multiprocessing;
static PyObject *__pyx_n_s_nCombinationsWithReplacement;
static PyObject *__pyx_n_s_nInd;
static PyObject *__pyx_n_s_nIndividuals;
static PyObject *__pyx_n_s_nVar;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_originalMaxHaplotypes;
static PyObject *__pyx_n_s_outputFile;
static PyObject *__pyx_n_s_outputRefCall;
static PyObject *__pyx_n_s_outputRefCalls;
static PyObject *__pyx_n_s_phredPValue;
static PyObject *__pyx_n_s_platypusOptions;
static PyObject *__pyx_n_s_platypusutils;
static PyObject *__pyx_n_s_pointerSize;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_probRef;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qual;
static PyObject *__pyx_n_s_qualBinSize;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_readBuffers;
static PyObject *__pyx_n_s_readSize;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_refCallBlockSize;
static PyObject *__pyx_n_s_refFile;
static PyObject *__pyx_n_s_regions;
static PyObject *__pyx_n_s_rlen;
static PyObject *__pyx_n_s_run;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_n_s_samples;
static PyObject *__pyx_n_s_samplesByBAM;
static PyObject *__pyx_n_s_samplesByID;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_seqQualSize;
static PyObject *__pyx_n_s_setfilter;
static PyObject *__pyx_n_s_setformat;
static PyObject *__pyx_n_s_setheader;
static PyObject *__pyx_n_s_setinfo;
static PyObject *__pyx_n_s_setsamples;
static PyObject *__pyx_n_s_singleProcess;
static PyObject *__pyx_n_s_skipDifficultWindows;
static PyObject *__pyx_n_s_source;
static PyObject *__pyx_n_s_sourceFile;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_startPos;
static PyObject *__pyx_kp_s_start_end_of_region_d_d;
static PyObject *__pyx_n_s_stdout;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_theBamFile;
static PyObject *__pyx_n_s_theBuffer;
static PyObject *__pyx_n_s_theFormat;
static PyObject *__pyx_n_s_theLock;
static PyObject *__pyx_n_s_theLocks;
static PyObject *__pyx_n_s_theReadBuffer;
static PyObject *__pyx_n_s_theStart;
static PyObject *__pyx_n_s_thisBadBufferSize;
static PyObject *__pyx_n_s_thisBufferSize;
static PyObject *__pyx_n_s_thisSample;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_totalBufferSize;
static PyObject *__pyx_n_s_totalReads;
static PyObject *__pyx_n_s_totalSeqQualSize;
static PyObject *__pyx_n_s_totalSize;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_variantcaller;
static PyObject *__pyx_n_s_variants;
static PyObject *__pyx_n_s_variantutils;
static PyObject *__pyx_n_s_vcf;
static PyObject *__pyx_n_s_vcfDataLine;
static PyObject *__pyx_n_s_vcfFile;
static PyObject *__pyx_n_s_vcfFilterSignature;
static PyObject *__pyx_n_s_vcfFormatSignature;
static PyObject *__pyx_n_s_vcfHeader;
static PyObject *__pyx_n_s_vcfInfoSignature;
static PyObject *__pyx_n_s_vcfutils;
static PyObject *__pyx_n_s_verbosity;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_window;
static PyObject *__pyx_n_s_windowEnd;
static PyObject *__pyx_n_s_windowGenerator;
static PyObject *__pyx_n_s_windowIndex;
static PyObject *__pyx_n_s_windowSize;
static PyObject *__pyx_n_s_windowStart;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_write_data;
static PyObject *__pyx_n_s_writeheader;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_13variantcaller_countTotalReadsInRegion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_readBuffers); /* proto */
static PyObject *__pyx_pf_13variantcaller_2outputRefCall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop, PyObject *__pyx_v_vcfFile, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_outputFile, CYTHON_UNUSED int __pyx_v_windowIndex, PyObject *__pyx_v_window, CYTHON_UNUSED PyObject *__pyx_v_options, PyObject *__pyx_v_readBuffers); /* proto */
static PyObject *__pyx_pf_13variantcaller_21PlatypusSingleProcess___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fileName, PyObject *__pyx_v_options, PyObject *__pyx_v_regions, PyObject *__pyx_v_continuing, CYTHON_UNUSED PyObject *__pyx_v_samples, CYTHON_UNUSED PyObject *__pyx_v_bamFileNames, CYTHON_UNUSED PyObject *__pyx_v_samplesByID, CYTHON_UNUSED PyObject *__pyx_v_samplesByBAM, PyObject *__pyx_v_bamFiles, PyObject *__pyx_v_theLocks); /* proto */
static PyObject *__pyx_pf_13variantcaller_21PlatypusSingleProcess_2run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_13variantcaller_20PlatypusMultiProcess___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fileName, PyObject *__pyx_v_options, PyObject *__pyx_v_regions, PyObject *__pyx_v_continuing, PyObject *__pyx_v_samples, PyObject *__pyx_v_bamFileNames, PyObject *__pyx_v_samplesByID, PyObject *__pyx_v_samplesByBAM, PyObject *__pyx_v_bamFiles, PyObject *__pyx_v_theLocks); /* proto */
static PyObject *__pyx_pf_13variantcaller_20PlatypusMultiProcess_2run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_neg_0_1;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_257;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_codeobj__10;
static PyObject *__pyx_codeobj__12;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__23;
/* Late includes */

/* "variantcaller.pyx":74
 * ###################################################################################################
 * 
 * cdef void callVariantsInWindow(dict window, options, FastaFile refFile, list readBuffers, Population pop, int start, int end, char* refSeq) except *:             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

static void __pyx_f_13variantcaller_callVariantsInWindow(PyObject *__pyx_v_window, PyObject *__pyx_v_options, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_readBuffers, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop, int __pyx_v_start, int __pyx_v_end, char *__pyx_v_refSeq) {
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theReadBuffer = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_variants = 0;
  int __pyx_v_windowStart;
  int __pyx_v_windowEnd;
  int __pyx_v_nReadsThisWindow;
  int __pyx_v_qualBinSize;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_refHaplotype = 0;
  PyObject *__pyx_v_allVarHaplotypes = 0;
  PyObject *__pyx_v_allUniqueHaplotypes = 0;
  PyObject *__pyx_v_allGenotypes = 0;
  int __pyx_v_nUniqueHaplotypes;
  int __pyx_v_maxEMIterations;
  __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;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  __Pyx_RefNannySetupContext("callVariantsInWindow", 0);

  /* "variantcaller.pyx":80
 *     cdef Variant v
 *     cdef bamReadBuffer theReadBuffer
 *     cdef bytes chrom = window['chromosome']             # <<<<<<<<<<<<<<
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 80, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_chromosome); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_v_chrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":81
 *     cdef bamReadBuffer theReadBuffer
 *     cdef bytes chrom = window['chromosome']
 *     cdef list variants = window["variants"]             # <<<<<<<<<<<<<<
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 81, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 81, __pyx_L1_error)
  __pyx_v_variants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":82
 *     cdef bytes chrom = window['chromosome']
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 82, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowStart = __pyx_t_2;

  /* "variantcaller.pyx":83
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']             # <<<<<<<<<<<<<<
 *     cdef int nReadsThisWindow = 0
 *     cdef int qualBinSize = options.qualBinSize
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 83, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowEnd = __pyx_t_2;

  /* "variantcaller.pyx":84
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0             # <<<<<<<<<<<<<<
 *     cdef int qualBinSize = options.qualBinSize
 * 
 */
  __pyx_v_nReadsThisWindow = 0;

  /* "variantcaller.pyx":85
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0
 *     cdef int qualBinSize = options.qualBinSize             # <<<<<<<<<<<<<<
 * 
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qualBinSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_qualBinSize = __pyx_t_2;

  /* "variantcaller.pyx":87
 *     cdef int qualBinSize = options.qualBinSize
 * 
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)             # <<<<<<<<<<<<<<
 * 
 *     pop.reset()
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_empty_tuple);
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_options);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_10chaplotype_Haplotype), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_refHaplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":89
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)
 * 
 *     pop.reset()             # <<<<<<<<<<<<<<
 * 
 *     for theReadBuffer in readBuffers:
 */
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->reset(__pyx_v_pop);

  /* "variantcaller.pyx":91
 *     pop.reset()
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 91, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 91, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 91, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "variantcaller.pyx":92
 * 
 *     for theReadBuffer in readBuffers:
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)             # <<<<<<<<<<<<<<
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 */
    ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theReadBuffer->__pyx_vtab)->setWindowPointers(__pyx_v_theReadBuffer, __pyx_v_windowStart, __pyx_v_windowEnd, __pyx_v_start, __pyx_v_end, __pyx_v_refSeq, __pyx_v_qualBinSize);

    /* "variantcaller.pyx":93
 *     for theReadBuffer in readBuffers:
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)             # <<<<<<<<<<<<<<
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 */
    __pyx_v_nReadsThisWindow = (__pyx_v_nReadsThisWindow + (__pyx_v_theReadBuffer->reads->windowEnd - __pyx_v_theReadBuffer->reads->windowStart));

    /* "variantcaller.pyx":91
 *     pop.reset()
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":95
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 */
  __pyx_t_8 = ((__pyx_v_nReadsThisWindow == 0) != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  __pyx_t_7 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":96
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":97
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_1);
      __pyx_t_4 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_No_coverage_in_window_s_s_s_Skip, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_10, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "variantcaller.pyx":96
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return
 */
    }

    /* "variantcaller.pyx":98
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if nReadsThisWindow > options.maxReads:
 */
    goto __pyx_L0;

    /* "variantcaller.pyx":95
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 */
  }

  /* "variantcaller.pyx":100
 *         return
 * 
 *     if nReadsThisWindow > options.maxReads:             # <<<<<<<<<<<<<<
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":101
 * 
 *     if nReadsThisWindow > options.maxReads:
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_10 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_pathalogical_window_s_s, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_11, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "variantcaller.pyx":102
 *     if nReadsThisWindow > options.maxReads:
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if len(variants) > options.maxVariants:
 */
    goto __pyx_L0;

    /* "variantcaller.pyx":100
 *         return
 * 
 *     if nReadsThisWindow > options.maxReads:             # <<<<<<<<<<<<<<
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return
 */
  }

  /* "variantcaller.pyx":104
 *         return
 * 
 *     if len(variants) > options.maxVariants:             # <<<<<<<<<<<<<<
 * 
 *         if options.skipDifficultWindows:
 */
  if (unlikely(__pyx_v_variants == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 104, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_variants); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 104, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxVariants); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":106
 *     if len(variants) > options.maxVariants:
 * 
 *         if options.skipDifficultWindows:             # <<<<<<<<<<<<<<
 *             logger.debug("Skipping window with %s variants" %(len(variants)))
 *             return
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_skipDifficultWindows); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":107
 * 
 *         if options.skipDifficultWindows:
 *             logger.debug("Skipping window with %s variants" %(len(variants)))             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__pyx_v_variants == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 107, __pyx_L1_error)
      }
      __pyx_t_6 = PyList_GET_SIZE(__pyx_v_variants); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 107, __pyx_L1_error)
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_window_with_s_variants, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":108
 *         if options.skipDifficultWindows:
 *             logger.debug("Skipping window with %s variants" %(len(variants)))
 *             return             # <<<<<<<<<<<<<<
 * 
 *         elif options.filterVarsByCoverage:
 */
      goto __pyx_L0;

      /* "variantcaller.pyx":106
 *     if len(variants) > options.maxVariants:
 * 
 *         if options.skipDifficultWindows:             # <<<<<<<<<<<<<<
 *             logger.debug("Skipping window with %s variants" %(len(variants)))
 *             return
 */
    }

    /* "variantcaller.pyx":110
 *             return
 * 
 *         elif options.filterVarsByCoverage:             # <<<<<<<<<<<<<<
 *             #logger.debug("There are %s variants before filtering" %(len(window['variants'])))
 *             filterVariantsByCoverage(window, chrom, windowStart, windowEnd, refFile, options, variants, refHaplotype, readBuffers)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_filterVarsByCoverage); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":112
 *         elif options.filterVarsByCoverage:
 *             #logger.debug("There are %s variants before filtering" %(len(window['variants'])))
 *             filterVariantsByCoverage(window, chrom, windowStart, windowEnd, refFile, options, variants, refHaplotype, readBuffers)             # <<<<<<<<<<<<<<
 *             #logger.debug("There are %s variants after filtering" %(len(window['variants'])))
 * 
 */
      __pyx_f_13variantFilter_filterVariantsByCoverage(__pyx_v_window, __pyx_v_chrom, __pyx_v_windowStart, __pyx_v_windowEnd, __pyx_v_refFile, __pyx_v_options, __pyx_v_variants, __pyx_v_refHaplotype, __pyx_v_readBuffers);

      /* "variantcaller.pyx":110
 *             return
 * 
 *         elif options.filterVarsByCoverage:             # <<<<<<<<<<<<<<
 *             #logger.debug("There are %s variants before filtering" %(len(window['variants'])))
 *             filterVariantsByCoverage(window, chrom, windowStart, windowEnd, refFile, options, variants, refHaplotype, readBuffers)
 */
    }

    /* "variantcaller.pyx":104
 *         return
 * 
 *     if len(variants) > options.maxVariants:             # <<<<<<<<<<<<<<
 * 
 *         if options.skipDifficultWindows:
 */
  }

  /* "variantcaller.pyx":116
 * 
 *     # Create haplotype list using all data from all samples. Always consider the reference haplotype.
 *     cdef list allVarHaplotypes = variantFilter.getHaplotypesInWindow(window, nReadsThisWindow, refFile, options.maxReads, options.minMapQual, options.minBaseQual, options.maxHaplotypes, options.maxVariants, options.rlen, options.verbosity, readBuffers, options)             # <<<<<<<<<<<<<<
 *     #cdef list allUniqueHaplotypes = list(set([refHaplotype] + allVarHaplotypes))
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minMapQual); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minBaseQual); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxVariants); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_f_13variantFilter_getHaplotypesInWindow(__pyx_v_window, __pyx_v_nReadsThisWindow, __pyx_v_refFile, __pyx_t_2, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_v_readBuffers, __pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_allVarHaplotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":118
 *     cdef list allVarHaplotypes = variantFilter.getHaplotypesInWindow(window, nReadsThisWindow, refFile, options.maxReads, options.minMapQual, options.minBaseQual, options.maxHaplotypes, options.maxVariants, options.rlen, options.verbosity, readBuffers, options)
 *     #cdef list allUniqueHaplotypes = list(set([refHaplotype] + allVarHaplotypes))
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)             # <<<<<<<<<<<<<<
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 */
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_allVarHaplotypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_1), __pyx_v_refFile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":119
 *     #cdef list allUniqueHaplotypes = list(set([refHaplotype] + allVarHaplotypes))
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 */
  __pyx_t_4 = __pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList(__pyx_v_allUniqueHaplotypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":121
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     if nUniqueHaplotypes <= 1:
 */
  if (unlikely(__pyx_v_allUniqueHaplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 121, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_allUniqueHaplotypes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 121, __pyx_L1_error)
  __pyx_v_nUniqueHaplotypes = __pyx_t_6;

  /* "variantcaller.pyx":123
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 * 
 *     if nUniqueHaplotypes <= 1:             # <<<<<<<<<<<<<<
 * 
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 */
  __pyx_t_7 = ((__pyx_v_nUniqueHaplotypes <= 1) != 0);
  if (__pyx_t_7) {

    /* "variantcaller.pyx":127
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 *         if not options.outputRefCalls:             # <<<<<<<<<<<<<<
 * 
 *             #logger.debug("No non-ref haplotypes to check in window %s. All var haps = %s. all Unique haps = %s" %(window, allVarHaplotypes, allUniqueHaplotypes))
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = ((!__pyx_t_7) != 0);
    if (__pyx_t_9) {

      /* "variantcaller.pyx":136
 *             #    logger.debug(hap.haplotypeSequence)
 * 
 *             return             # <<<<<<<<<<<<<<
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)
 */
      goto __pyx_L0;

      /* "variantcaller.pyx":127
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 *         if not options.outputRefCalls:             # <<<<<<<<<<<<<<
 * 
 *             #logger.debug("No non-ref haplotypes to check in window %s. All var haps = %s. all Unique haps = %s" %(window, allVarHaplotypes, allUniqueHaplotypes))
 */
    }

    /* "variantcaller.pyx":123
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 * 
 *     if nUniqueHaplotypes <= 1:             # <<<<<<<<<<<<<<
 * 
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 */
  }

  /* "variantcaller.pyx":138
 *             return
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     cdef int maxEMIterations = 100
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_nInd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->setup(__pyx_v_pop, __pyx_v_variants, __pyx_v_allUniqueHaplotypes, __pyx_v_allGenotypes, __pyx_t_17, __pyx_t_16, __pyx_v_readBuffers);

  /* "variantcaller.pyx":140
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)
 * 
 *     cdef int maxEMIterations = 100             # <<<<<<<<<<<<<<
 *     pop.call(maxEMIterations, 1)
 * 
 */
  __pyx_v_maxEMIterations = 0x64;

  /* "variantcaller.pyx":141
 * 
 *     cdef int maxEMIterations = 100
 *     pop.call(maxEMIterations, 1)             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->call(__pyx_v_pop, __pyx_v_maxEMIterations, 1);

  /* "variantcaller.pyx":74
 * ###################################################################################################
 * 
 * cdef void callVariantsInWindow(dict window, options, FastaFile refFile, list readBuffers, Population pop, int start, int end, char* refSeq) except *:             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

  /* function exit code */
  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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("variantcaller.callVariantsInWindow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theReadBuffer);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_variants);
  __Pyx_XDECREF((PyObject *)__pyx_v_refHaplotype);
  __Pyx_XDECREF(__pyx_v_allVarHaplotypes);
  __Pyx_XDECREF(__pyx_v_allUniqueHaplotypes);
  __Pyx_XDECREF(__pyx_v_allGenotypes);
  __Pyx_RefNannyFinishContext();
}

/* "variantcaller.pyx":146
 * ###################################################################################################
 * 
 * cdef list callHLAVariantsInWindow(dict window, options, FastaFile refFile, list readBuffers, Population pop, int start, int end, char* refSeq):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

static PyObject *__pyx_f_13variantcaller_callHLAVariantsInWindow(PyObject *__pyx_v_window, PyObject *__pyx_v_options, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_readBuffers, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop, int __pyx_v_start, int __pyx_v_end, char *__pyx_v_refSeq) {
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theReadBuffer = 0;
  PyObject *__pyx_v_chrom = 0;
  PyObject *__pyx_v_variants = 0;
  int __pyx_v_windowStart;
  int __pyx_v_windowEnd;
  int __pyx_v_nReadsThisWindow;
  int __pyx_v_qualBinSize;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_refHaplotype = 0;
  PyObject *__pyx_v_allVarHaplotypes = 0;
  PyObject *__pyx_v_allUniqueHaplotypes = 0;
  PyObject *__pyx_v_allGenotypes = 0;
  int __pyx_v_nUniqueHaplotypes;
  int __pyx_v_maxEMIterations;
  PyObject *__pyx_v_longVars = 0;
  struct __pyx_obj_9cgenotype_DiploidGenotype *__pyx_v_gt = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap1 = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap2 = 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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __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_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  __Pyx_RefNannySetupContext("callHLAVariantsInWindow", 0);

  /* "variantcaller.pyx":152
 *     cdef Variant v
 *     cdef bamReadBuffer theReadBuffer
 *     cdef bytes chrom = window['chromosome']             # <<<<<<<<<<<<<<
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 152, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_chromosome); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  __pyx_v_chrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":153
 *     cdef bamReadBuffer theReadBuffer
 *     cdef bytes chrom = window['chromosome']
 *     cdef list variants = window["variants"]             # <<<<<<<<<<<<<<
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 153, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 153, __pyx_L1_error)
  __pyx_v_variants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":154
 *     cdef bytes chrom = window['chromosome']
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 154, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowStart = __pyx_t_2;

  /* "variantcaller.pyx":155
 *     cdef list variants = window["variants"]
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']             # <<<<<<<<<<<<<<
 *     cdef int nReadsThisWindow = 0
 *     cdef int qualBinSize = options.qualBinSize
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 155, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowEnd = __pyx_t_2;

  /* "variantcaller.pyx":156
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0             # <<<<<<<<<<<<<<
 *     cdef int qualBinSize = options.qualBinSize
 * 
 */
  __pyx_v_nReadsThisWindow = 0;

  /* "variantcaller.pyx":157
 *     cdef int windowEnd = window['endPos']
 *     cdef int nReadsThisWindow = 0
 *     cdef int qualBinSize = options.qualBinSize             # <<<<<<<<<<<<<<
 * 
 *     logger.info("In HLA variant window %d %d", windowStart, windowEnd)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qualBinSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_qualBinSize = __pyx_t_2;

  /* "variantcaller.pyx":159
 *     cdef int qualBinSize = options.qualBinSize
 * 
 *     logger.info("In HLA variant window %d %d", windowStart, windowEnd)             # <<<<<<<<<<<<<<
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_2 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_2 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_kp_s_In_HLA_variant_window_d_d, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_kp_s_In_HLA_variant_window_d_d, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_In_HLA_variant_window_d_d);
    __Pyx_GIVEREF(__pyx_kp_s_In_HLA_variant_window_d_d);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_kp_s_In_HLA_variant_window_d_d);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_2, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":160
 * 
 *     logger.info("In HLA variant window %d %d", windowStart, windowEnd)
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)             # <<<<<<<<<<<<<<
 * 
 *     pop.reset()
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyTuple_New(7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_empty_tuple);
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_7);
  __Pyx_INCREF(__pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_options);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_10chaplotype_Haplotype), __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_refHaplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "variantcaller.pyx":162
 *     cdef Haplotype refHaplotype = Haplotype(chrom, windowStart, windowEnd, (), refFile, options.rlen, options)
 * 
 *     pop.reset()             # <<<<<<<<<<<<<<
 * 
 *     for theReadBuffer in readBuffers:
 */
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->reset(__pyx_v_pop);

  /* "variantcaller.pyx":164
 *     pop.reset()
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 164, __pyx_L1_error)
  }
  __pyx_t_7 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 164, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 164, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "variantcaller.pyx":165
 * 
 *     for theReadBuffer in readBuffers:
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)             # <<<<<<<<<<<<<<
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 */
    ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theReadBuffer->__pyx_vtab)->setWindowPointers(__pyx_v_theReadBuffer, __pyx_v_windowStart, __pyx_v_windowEnd, __pyx_v_start, __pyx_v_end, __pyx_v_refSeq, __pyx_v_qualBinSize);

    /* "variantcaller.pyx":166
 *     for theReadBuffer in readBuffers:
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)             # <<<<<<<<<<<<<<
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 */
    __pyx_v_nReadsThisWindow = (__pyx_v_nReadsThisWindow + (__pyx_v_theReadBuffer->reads->windowEnd - __pyx_v_theReadBuffer->reads->windowStart));

    /* "variantcaller.pyx":164
 *     pop.reset()
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(windowStart, windowEnd, start, end, refSeq, qualBinSize)
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":168
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 */
  __pyx_t_10 = ((__pyx_v_nReadsThisWindow == 0) != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_9 = __pyx_t_10;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = ((!__pyx_t_10) != 0);
  __pyx_t_9 = __pyx_t_11;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_9) {

    /* "variantcaller.pyx":169
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_9) {

      /* "variantcaller.pyx":170
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
      __pyx_t_7 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_No_coverage_in_window_s_s_s_Skip, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "variantcaller.pyx":169
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return
 */
    }

    /* "variantcaller.pyx":171
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if nReadsThisWindow > options.maxReads:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "variantcaller.pyx":168
 *         nReadsThisWindow += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 * 
 *     if nReadsThisWindow == 0 and not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *         if options.verbosity >= 3:
 *             logger.debug("No coverage in window %s:%s-%s. Skipping" %(chrom, windowStart, windowEnd))
 */
  }

  /* "variantcaller.pyx":173
 *         return
 * 
 *     if nReadsThisWindow > options.maxReads:             # <<<<<<<<<<<<<<
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_9) {

    /* "variantcaller.pyx":174
 * 
 *     if nReadsThisWindow > options.maxReads:
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))             # <<<<<<<<<<<<<<
 *         return
 *     logger.debug("Processing window %s:%s-%s" %(chrom, windowStart, windowEnd))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_7);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_pathalogical_window_s_s, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "variantcaller.pyx":175
 *     if nReadsThisWindow > options.maxReads:
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return             # <<<<<<<<<<<<<<
 *     logger.debug("Processing window %s:%s-%s" %(chrom, windowStart, windowEnd))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "variantcaller.pyx":173
 *         return
 * 
 *     if nReadsThisWindow > options.maxReads:             # <<<<<<<<<<<<<<
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return
 */
  }

  /* "variantcaller.pyx":176
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))
 *         return
 *     logger.debug("Processing window %s:%s-%s" %(chrom, windowStart, windowEnd))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Processing_window_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":180
 * 
 *     # Create haplotype list using all data from all samples. Always consider the reference haplotype.
 *     cdef list allVarHaplotypes = variantFilter.getHaplotypesInWindow(window, nReadsThisWindow, refFile, options.maxReads, options.minMapQual, options.minBaseQual, options.maxHaplotypes, options.maxVariants, options.rlen, options.verbosity, readBuffers, options)             # <<<<<<<<<<<<<<
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minMapQual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minBaseQual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxVariants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_f_13variantFilter_getHaplotypesInWindow(__pyx_v_window, __pyx_v_nReadsThisWindow, __pyx_v_refFile, __pyx_t_2, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_v_readBuffers, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allVarHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":181
 *     # Create haplotype list using all data from all samples. Always consider the reference haplotype.
 *     cdef list allVarHaplotypes = variantFilter.getHaplotypesInWindow(window, nReadsThisWindow, refFile, options.maxReads, options.minMapQual, options.minBaseQual, options.maxHaplotypes, options.maxVariants, options.rlen, options.verbosity, readBuffers, options)
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)             # <<<<<<<<<<<<<<
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_allVarHaplotypes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_7), __pyx_v_refFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":182
 *     cdef list allVarHaplotypes = variantFilter.getHaplotypesInWindow(window, nReadsThisWindow, refFile, options.maxReads, options.minMapQual, options.minBaseQual, options.maxHaplotypes, options.maxVariants, options.rlen, options.verbosity, readBuffers, options)
 *     cdef list allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allVarHaplotypes, refFile)
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 */
  __pyx_t_1 = __pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList(__pyx_v_allUniqueHaplotypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":184
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     if nUniqueHaplotypes <= 1:
 */
  if (unlikely(__pyx_v_allUniqueHaplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 184, __pyx_L1_error)
  }
  __pyx_t_8 = PyList_GET_SIZE(__pyx_v_allUniqueHaplotypes); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 184, __pyx_L1_error)
  __pyx_v_nUniqueHaplotypes = __pyx_t_8;

  /* "variantcaller.pyx":186
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 * 
 *     if nUniqueHaplotypes <= 1:             # <<<<<<<<<<<<<<
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 */
  __pyx_t_9 = ((__pyx_v_nUniqueHaplotypes <= 1) != 0);
  if (__pyx_t_9) {

    /* "variantcaller.pyx":189
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 *         if not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *             return []
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = ((!__pyx_t_9) != 0);
    if (__pyx_t_11) {

      /* "variantcaller.pyx":190
 *         # reference.
 *         if not options.outputRefCalls:
 *             return []             # <<<<<<<<<<<<<<
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "variantcaller.pyx":189
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 *         if not options.outputRefCalls:             # <<<<<<<<<<<<<<
 *             return []
 * 
 */
    }

    /* "variantcaller.pyx":186
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)
 * 
 *     if nUniqueHaplotypes <= 1:             # <<<<<<<<<<<<<<
 *         # This occurs if we found mutation candidates, but the sequences of the mutated haplotypes are all the same as the
 *         # reference.
 */
  }

  /* "variantcaller.pyx":192
 *             return []
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     cdef int maxEMIterations = 100
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_nInd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->setup(__pyx_v_pop, __pyx_v_variants, __pyx_v_allUniqueHaplotypes, __pyx_v_allGenotypes, __pyx_t_17, __pyx_t_16, __pyx_v_readBuffers);

  /* "variantcaller.pyx":194
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)
 * 
 *     cdef int maxEMIterations = 100             # <<<<<<<<<<<<<<
 *     pop.call(maxEMIterations, 1)
 * 
 */
  __pyx_v_maxEMIterations = 0x64;

  /* "variantcaller.pyx":195
 * 
 *     cdef int maxEMIterations = 100
 *     pop.call(maxEMIterations, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef list longVars=[]
 */
  ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->call(__pyx_v_pop, __pyx_v_maxEMIterations, 1);

  /* "variantcaller.pyx":197
 *     pop.call(maxEMIterations, 1)
 * 
 *     cdef list longVars=[]             # <<<<<<<<<<<<<<
 *     cdef DiploidGenotype gt  = pop.genotypeCalls[0]
 *     cdef Haplotype hap1 = gt.hap1
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_longVars = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":198
 * 
 *     cdef list longVars=[]
 *     cdef DiploidGenotype gt  = pop.genotypeCalls[0]             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap1 = gt.hap1
 *     cdef Haplotype hap2 = gt.hap2
 */
  if (unlikely(__pyx_v_pop->genotypeCalls == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 198, __pyx_L1_error)
  }
  if (!(likely(((PyList_GET_ITEM(__pyx_v_pop->genotypeCalls, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_pop->genotypeCalls, 0), __pyx_ptype_9cgenotype_DiploidGenotype))))) __PYX_ERR(0, 198, __pyx_L1_error)
  __pyx_t_1 = PyList_GET_ITEM(__pyx_v_pop->genotypeCalls, 0);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_gt = ((struct __pyx_obj_9cgenotype_DiploidGenotype *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":199
 *     cdef list longVars=[]
 *     cdef DiploidGenotype gt  = pop.genotypeCalls[0]
 *     cdef Haplotype hap1 = gt.hap1             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap2 = gt.hap2
 *     cdef Variant thisVar
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_gt->hap1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_hap1 = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":200
 *     cdef DiploidGenotype gt  = pop.genotypeCalls[0]
 *     cdef Haplotype hap1 = gt.hap1
 *     cdef Haplotype hap2 = gt.hap2             # <<<<<<<<<<<<<<
 *     cdef Variant thisVar
 *     if hap1 != refHaplotype:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_gt->hap2);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_hap2 = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":202
 *     cdef Haplotype hap2 = gt.hap2
 *     cdef Variant thisVar
 *     if hap1 != refHaplotype:             # <<<<<<<<<<<<<<
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_hap1), ((PyObject *)__pyx_v_refHaplotype), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_11) {

    /* "variantcaller.pyx":203
 *     cdef Variant thisVar
 *     if hap1 != refHaplotype:
 *         longVars.append(normaliseVar(hap1.longVar))             # <<<<<<<<<<<<<<
 *     if hap2 != refHaplotype and hap1!= hap2:
 *         longVars.append(normaliseVar(hap2.longVar))
 */
    __pyx_t_1 = ((PyObject *)__pyx_v_hap1->longVar);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_7 = ((PyObject *)__pyx_f_13variantFilter_normaliseVar(((struct __pyx_obj_7variant_Variant *)__pyx_t_1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_longVars, __pyx_t_7); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "variantcaller.pyx":202
 *     cdef Haplotype hap2 = gt.hap2
 *     cdef Variant thisVar
 *     if hap1 != refHaplotype:             # <<<<<<<<<<<<<<
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:
 */
  }

  /* "variantcaller.pyx":204
 *     if hap1 != refHaplotype:
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:             # <<<<<<<<<<<<<<
 *         longVars.append(normaliseVar(hap2.longVar))
 *     return longVars
 */
  __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_hap2), ((PyObject *)__pyx_v_refHaplotype), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_9) {
  } else {
    __pyx_t_11 = __pyx_t_9;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_hap1), ((PyObject *)__pyx_v_hap2), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_11 = __pyx_t_9;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_11) {

    /* "variantcaller.pyx":205
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:
 *         longVars.append(normaliseVar(hap2.longVar))             # <<<<<<<<<<<<<<
 *     return longVars
 * 
 */
    __pyx_t_7 = ((PyObject *)__pyx_v_hap2->longVar);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_1 = ((PyObject *)__pyx_f_13variantFilter_normaliseVar(((struct __pyx_obj_7variant_Variant *)__pyx_t_7))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_longVars, __pyx_t_1); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "variantcaller.pyx":204
 *     if hap1 != refHaplotype:
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:             # <<<<<<<<<<<<<<
 *         longVars.append(normaliseVar(hap2.longVar))
 *     return longVars
 */
  }

  /* "variantcaller.pyx":206
 *     if hap2 != refHaplotype and hap1!= hap2:
 *         longVars.append(normaliseVar(hap2.longVar))
 *     return longVars             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_longVars);
  __pyx_r = __pyx_v_longVars;
  goto __pyx_L0;

  /* "variantcaller.pyx":146
 * ###################################################################################################
 * 
 * cdef list callHLAVariantsInWindow(dict window, options, FastaFile refFile, list readBuffers, Population pop, int start, int end, char* refSeq):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

  /* function exit code */
  __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_7);
  __Pyx_AddTraceback("variantcaller.callHLAVariantsInWindow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theReadBuffer);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_variants);
  __Pyx_XDECREF((PyObject *)__pyx_v_refHaplotype);
  __Pyx_XDECREF(__pyx_v_allVarHaplotypes);
  __Pyx_XDECREF(__pyx_v_allUniqueHaplotypes);
  __Pyx_XDECREF(__pyx_v_allGenotypes);
  __Pyx_XDECREF(__pyx_v_longVars);
  __Pyx_XDECREF((PyObject *)__pyx_v_gt);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap1);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_1countTotalReadsInRegion(PyObject *__pyx_self, PyObject *__pyx_v_readBuffers); /*proto*/
static char __pyx_doc_13variantcaller_countTotalReadsInRegion[] = "\n    Count and return the total number of reads (good, bad, broken)\n    loaded into the read buffers.\n    ";
static PyMethodDef __pyx_mdef_13variantcaller_1countTotalReadsInRegion = {"countTotalReadsInRegion", (PyCFunction)__pyx_pw_13variantcaller_1countTotalReadsInRegion, METH_O, __pyx_doc_13variantcaller_countTotalReadsInRegion};
static PyObject *__pyx_pw_13variantcaller_1countTotalReadsInRegion(PyObject *__pyx_self, PyObject *__pyx_v_readBuffers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countTotalReadsInRegion (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_readBuffers), (&PyList_Type), 1, "readBuffers", 1))) __PYX_ERR(0, 209, __pyx_L1_error)
  __pyx_r = __pyx_pf_13variantcaller_countTotalReadsInRegion(__pyx_self, ((PyObject*)__pyx_v_readBuffers));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_countTotalReadsInRegion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_readBuffers) {
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theReadBuffer = 0;
  PyObject *__pyx_v_totalReads = NULL;
  PyObject *__pyx_v_cigarSize = NULL;
  PyObject *__pyx_v_seqQualSize = NULL;
  PyObject *__pyx_v_readSize = NULL;
  PyObject *__pyx_v_pointerSize = NULL;
  PyObject *__pyx_v_totalBufferSize = NULL;
  PyObject *__pyx_v_totalSeqQualSize = NULL;
  PyObject *__pyx_v_thisBufferSize = NULL;
  PyObject *__pyx_v_thisBadBufferSize = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_totalSize = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("countTotalReadsInRegion", 0);

  /* "variantcaller.pyx":215
 *     """
 *     cdef bamReadBuffer theReadBuffer
 *     totalReads = 0             # <<<<<<<<<<<<<<
 *     cigarSize = 0
 *     seqQualSize = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_totalReads = __pyx_int_0;

  /* "variantcaller.pyx":216
 *     cdef bamReadBuffer theReadBuffer
 *     totalReads = 0
 *     cigarSize = 0             # <<<<<<<<<<<<<<
 *     seqQualSize = 0
 *     readSize = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_cigarSize = __pyx_int_0;

  /* "variantcaller.pyx":217
 *     totalReads = 0
 *     cigarSize = 0
 *     seqQualSize = 0             # <<<<<<<<<<<<<<
 *     readSize = 0
 *     pointerSize = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_seqQualSize = __pyx_int_0;

  /* "variantcaller.pyx":218
 *     cigarSize = 0
 *     seqQualSize = 0
 *     readSize = 0             # <<<<<<<<<<<<<<
 *     pointerSize = 0
 *     totalBufferSize = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_readSize = __pyx_int_0;

  /* "variantcaller.pyx":219
 *     seqQualSize = 0
 *     readSize = 0
 *     pointerSize = 0             # <<<<<<<<<<<<<<
 *     totalBufferSize = 0
 *     totalSeqQualSize = 0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_pointerSize = __pyx_int_0;

  /* "variantcaller.pyx":220
 *     readSize = 0
 *     pointerSize = 0
 *     totalBufferSize = 0             # <<<<<<<<<<<<<<
 *     totalSeqQualSize = 0
 * 
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_totalBufferSize = __pyx_int_0;

  /* "variantcaller.pyx":221
 *     pointerSize = 0
 *     totalBufferSize = 0
 *     totalSeqQualSize = 0             # <<<<<<<<<<<<<<
 * 
 *     for theReadBuffer in readBuffers:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_totalSeqQualSize = __pyx_int_0;

  /* "variantcaller.pyx":223
 *     totalSeqQualSize = 0
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         thisBufferSize = theReadBuffer.reads.getSize()
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 223, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 223, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":224
 * 
 *     for theReadBuffer in readBuffers:
 *         thisBufferSize = theReadBuffer.reads.getSize()             # <<<<<<<<<<<<<<
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()
 *         totalReads += (theReadBuffer.reads.getSize())
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->reads)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_thisBufferSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":225
 *     for theReadBuffer in readBuffers:
 *         thisBufferSize = theReadBuffer.reads.getSize()
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()             # <<<<<<<<<<<<<<
 *         totalReads += (theReadBuffer.reads.getSize())
 *         totalReads += (theReadBuffer.badReads.getSize())
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->badReads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->badReads)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_thisBadBufferSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":226
 *         thisBufferSize = theReadBuffer.reads.getSize()
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()
 *         totalReads += (theReadBuffer.reads.getSize())             # <<<<<<<<<<<<<<
 *         totalReads += (theReadBuffer.badReads.getSize())
 *         totalReads += (theReadBuffer.brokenMates.getSize())
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->reads)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_totalReads, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalReads, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":227
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()
 *         totalReads += (theReadBuffer.reads.getSize())
 *         totalReads += (theReadBuffer.badReads.getSize())             # <<<<<<<<<<<<<<
 *         totalReads += (theReadBuffer.brokenMates.getSize())
 *         totalBufferSize += (theReadBuffer.reads.__capacity)
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->badReads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->badReads)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalReads, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalReads, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":228
 *         totalReads += (theReadBuffer.reads.getSize())
 *         totalReads += (theReadBuffer.badReads.getSize())
 *         totalReads += (theReadBuffer.brokenMates.getSize())             # <<<<<<<<<<<<<<
 *         totalBufferSize += (theReadBuffer.reads.__capacity)
 *         totalBufferSize += (theReadBuffer.badReads.__capacity)
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->brokenMates->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->brokenMates)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_totalReads, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalReads, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":229
 *         totalReads += (theReadBuffer.badReads.getSize())
 *         totalReads += (theReadBuffer.brokenMates.getSize())
 *         totalBufferSize += (theReadBuffer.reads.__capacity)             # <<<<<<<<<<<<<<
 *         totalBufferSize += (theReadBuffer.badReads.__capacity)
 *         totalBufferSize += (theReadBuffer.brokenMates.__capacity)
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_theReadBuffer->reads->__pyx___capacity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalBufferSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalBufferSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":230
 *         totalReads += (theReadBuffer.brokenMates.getSize())
 *         totalBufferSize += (theReadBuffer.reads.__capacity)
 *         totalBufferSize += (theReadBuffer.badReads.__capacity)             # <<<<<<<<<<<<<<
 *         totalBufferSize += (theReadBuffer.brokenMates.__capacity)
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_theReadBuffer->badReads->__pyx___capacity); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_totalBufferSize, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalBufferSize, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":231
 *         totalBufferSize += (theReadBuffer.reads.__capacity)
 *         totalBufferSize += (theReadBuffer.badReads.__capacity)
 *         totalBufferSize += (theReadBuffer.brokenMates.__capacity)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(thisBufferSize):
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_theReadBuffer->brokenMates->__pyx___capacity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalBufferSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalBufferSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":233
 *         totalBufferSize += (theReadBuffer.brokenMates.__capacity)
 * 
 *         for i in range(thisBufferSize):             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_thisBufferSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(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_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 233, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 233, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":234
 * 
 *         for i in range(thisBufferSize):
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 * 
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->seq) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":235
 *         for i in range(thisBufferSize):
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)             # <<<<<<<<<<<<<<
 * 
 *             totalSeqQualSize += 2*theReadBuffer.reads.array[i].cigarLen
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->qual) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":237
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 * 
 *             totalSeqQualSize += 2*theReadBuffer.reads.array[i].cigarLen             # <<<<<<<<<<<<<<
 * 
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyInt_From_long((2 * (__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->cigarLen)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":239
 *             totalSeqQualSize += 2*theReadBuffer.reads.array[i].cigarLen
 * 
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)             # <<<<<<<<<<<<<<
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 * 
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->seq) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_seqQualSize, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_seqQualSize, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":240
 * 
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)             # <<<<<<<<<<<<<<
 * 
 *             cigarSize += 2*theReadBuffer.reads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->qual) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_seqQualSize, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_seqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":242
 *             seqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 * 
 *             cigarSize += 2*theReadBuffer.reads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])             # <<<<<<<<<<<<<<
 * 
 *         for i in range(thisBadBufferSize):
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t(((2 * (__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->cigarLen) * (sizeof(((__pyx_v_theReadBuffer->reads->array[0])->cigarOps[0]))))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_cigarSize, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_cigarSize, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":233
 *         totalBufferSize += (theReadBuffer.brokenMates.__capacity)
 * 
 *         for i in range(thisBufferSize):             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.reads.array[i].qual) + 1)
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":244
 *             cigarSize += 2*theReadBuffer.reads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])
 * 
 *         for i in range(thisBadBufferSize):             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 */
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_thisBadBufferSize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_6(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 244, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "variantcaller.pyx":245
 * 
 *         for i in range(thisBadBufferSize):
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 * 
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->seq) + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":246
 *         for i in range(thisBadBufferSize):
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)             # <<<<<<<<<<<<<<
 * 
 *             totalSeqQualSize += 2*theReadBuffer.badReads.array[i].cigarLen
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->qual) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "variantcaller.pyx":248
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 * 
 *             totalSeqQualSize += 2*theReadBuffer.badReads.array[i].cigarLen             # <<<<<<<<<<<<<<
 * 
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyInt_From_long((2 * (__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->cigarLen)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":250
 *             totalSeqQualSize += 2*theReadBuffer.badReads.array[i].cigarLen
 * 
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)             # <<<<<<<<<<<<<<
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 * 
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->seq) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_seqQualSize, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_seqQualSize, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "variantcaller.pyx":251
 * 
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)             # <<<<<<<<<<<<<<
 * 
 *             cigarSize += 2*theReadBuffer.badReads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->qual) + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_seqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_seqQualSize, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":253
 *             seqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 * 
 *             cigarSize += 2*theReadBuffer.badReads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])             # <<<<<<<<<<<<<<
 * 
 *         # Size of reads
 */
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_FromSize_t(((2 * (__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->cigarLen) * (sizeof(((__pyx_v_theReadBuffer->reads->array[0])->cigarOps[0]))))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_cigarSize, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_cigarSize, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "variantcaller.pyx":244
 *             cigarSize += 2*theReadBuffer.reads.array[i].cigarLen*sizeof(theReadBuffer.reads.array[0].cigarOps[0])
 * 
 *         for i in range(thisBadBufferSize):             # <<<<<<<<<<<<<<
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].seq) + 1)
 *             totalSeqQualSize += (strlen(theReadBuffer.badReads.array[i].qual) + 1)
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "variantcaller.pyx":256
 * 
 *         # Size of reads
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0][0])*thisBufferSize             # <<<<<<<<<<<<<<
 *         totalSeqQualSize += sizeof(theReadBuffer.badReads.array[0][0])*thisBadBufferSize
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(((__pyx_v_theReadBuffer->reads->array[0])[0])))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_thisBufferSize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":257
 *         # Size of reads
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0][0])*thisBufferSize
 *         totalSeqQualSize += sizeof(theReadBuffer.badReads.array[0][0])*thisBadBufferSize             # <<<<<<<<<<<<<<
 * 
 *         readSize += sizeof(theReadBuffer.reads.array[0][0])*thisBufferSize
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(((__pyx_v_theReadBuffer->badReads->array[0])[0])))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_thisBadBufferSize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":259
 *         totalSeqQualSize += sizeof(theReadBuffer.badReads.array[0][0])*thisBadBufferSize
 * 
 *         readSize += sizeof(theReadBuffer.reads.array[0][0])*thisBufferSize             # <<<<<<<<<<<<<<
 *         readSize += sizeof(theReadBuffer.badReads.array[0][0])*thisBadBufferSize
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(((__pyx_v_theReadBuffer->reads->array[0])[0])))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_thisBufferSize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_readSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_readSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":260
 * 
 *         readSize += sizeof(theReadBuffer.reads.array[0][0])*thisBufferSize
 *         readSize += sizeof(theReadBuffer.badReads.array[0][0])*thisBadBufferSize             # <<<<<<<<<<<<<<
 * 
 *         # Size of pointers to reads
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(((__pyx_v_theReadBuffer->badReads->array[0])[0])))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_thisBadBufferSize); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_readSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_readSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":263
 * 
 *         # Size of pointers to reads
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.reads.__capacity             # <<<<<<<<<<<<<<
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t(((sizeof((__pyx_v_theReadBuffer->reads->array[0]))) * __pyx_v_theReadBuffer->reads->__pyx___capacity)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":264
 *         # Size of pointers to reads
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.reads.__capacity
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity             # <<<<<<<<<<<<<<
 * 
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.reads.__capacity
 */
    __pyx_t_4 = __Pyx_PyInt_FromSize_t(((sizeof((__pyx_v_theReadBuffer->reads->array[0]))) * __pyx_v_theReadBuffer->badReads->__pyx___capacity)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_totalSeqQualSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_totalSeqQualSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":266
 *         totalSeqQualSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity
 * 
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.reads.__capacity             # <<<<<<<<<<<<<<
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_FromSize_t(((sizeof((__pyx_v_theReadBuffer->reads->array[0]))) * __pyx_v_theReadBuffer->reads->__pyx___capacity)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_pointerSize, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_pointerSize, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":267
 * 
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.reads.__capacity
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity             # <<<<<<<<<<<<<<
 * 
 *     totalSize = seqQualSize + cigarSize + readSize + pointerSize
 */
    __pyx_t_4 = __Pyx_PyInt_FromSize_t(((sizeof((__pyx_v_theReadBuffer->reads->array[0]))) * __pyx_v_theReadBuffer->badReads->__pyx___capacity)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_pointerSize, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_pointerSize, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":223
 *     totalSeqQualSize = 0
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         thisBufferSize = theReadBuffer.reads.getSize()
 *         thisBadBufferSize = theReadBuffer.badReads.getSize()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":269
 *         pointerSize += sizeof(theReadBuffer.reads.array[0])*theReadBuffer.badReads.__capacity
 * 
 *     totalSize = seqQualSize + cigarSize + readSize + pointerSize             # <<<<<<<<<<<<<<
 *     logger.debug("Sizes: SeqQual = %s. cigar = %s. read = %s. pointers = %s. Total = %s" %(seqQualSize, cigarSize, readSize, pointerSize, totalSize))
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_seqQualSize, __pyx_v_cigarSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_readSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_v_pointerSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_totalSize = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":270
 * 
 *     totalSize = seqQualSize + cigarSize + readSize + pointerSize
 *     logger.debug("Sizes: SeqQual = %s. cigar = %s. read = %s. pointers = %s. Total = %s" %(seqQualSize, cigarSize, readSize, pointerSize, totalSize))             # <<<<<<<<<<<<<<
 * 
 *     return totalReads,totalBufferSize,totalSeqQualSize
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_seqQualSize);
  __Pyx_GIVEREF(__pyx_v_seqQualSize);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_seqQualSize);
  __Pyx_INCREF(__pyx_v_cigarSize);
  __Pyx_GIVEREF(__pyx_v_cigarSize);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cigarSize);
  __Pyx_INCREF(__pyx_v_readSize);
  __Pyx_GIVEREF(__pyx_v_readSize);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_readSize);
  __Pyx_INCREF(__pyx_v_pointerSize);
  __Pyx_GIVEREF(__pyx_v_pointerSize);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_pointerSize);
  __Pyx_INCREF(__pyx_v_totalSize);
  __Pyx_GIVEREF(__pyx_v_totalSize);
  PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_totalSize);
  __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Sizes_SeqQual_s_cigar_s_read_s_p, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":272
 *     logger.debug("Sizes: SeqQual = %s. cigar = %s. read = %s. pointers = %s. Total = %s" %(seqQualSize, cigarSize, readSize, pointerSize, totalSize))
 * 
 *     return totalReads,totalBufferSize,totalSeqQualSize             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_totalReads);
  __Pyx_GIVEREF(__pyx_v_totalReads);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_totalReads);
  __Pyx_INCREF(__pyx_v_totalBufferSize);
  __Pyx_GIVEREF(__pyx_v_totalBufferSize);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_totalBufferSize);
  __Pyx_INCREF(__pyx_v_totalSeqQualSize);
  __Pyx_GIVEREF(__pyx_v_totalSeqQualSize);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_totalSeqQualSize);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("variantcaller.countTotalReadsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theReadBuffer);
  __Pyx_XDECREF(__pyx_v_totalReads);
  __Pyx_XDECREF(__pyx_v_cigarSize);
  __Pyx_XDECREF(__pyx_v_seqQualSize);
  __Pyx_XDECREF(__pyx_v_readSize);
  __Pyx_XDECREF(__pyx_v_pointerSize);
  __Pyx_XDECREF(__pyx_v_totalBufferSize);
  __Pyx_XDECREF(__pyx_v_totalSeqQualSize);
  __Pyx_XDECREF(__pyx_v_thisBufferSize);
  __Pyx_XDECREF(__pyx_v_thisBadBufferSize);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_totalSize);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":276
 * ###################################################################################################
 * 
 * cdef int doWeNeedToAssembleThisRegion(list readBuffers, bytes chrom, int start, int end, options, char* refSeq):             # <<<<<<<<<<<<<<
 *     """
 *     Scan through the specified region, and report whether or not we need to run the assember to
 */

static int __pyx_f_13variantcaller_doWeNeedToAssembleThisRegion(PyObject *__pyx_v_readBuffers, PyObject *__pyx_v_chrom, int __pyx_v_start, int __pyx_v_end, PyObject *__pyx_v_options, char *__pyx_v_refSeq) {
  double __pyx_v_totalReads;
  double __pyx_v_readsThisSample;
  double __pyx_v_badReadsThisSample;
  CYTHON_UNUSED double __pyx_v_totalMismatches;
  double __pyx_v_totalAlignmentGaps;
  double __pyx_v_nImproperReads;
  int __pyx_v_qualBinSize;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theReadBuffer = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("doWeNeedToAssembleThisRegion", 0);

  /* "variantcaller.pyx":282
 *     mapping qualities, numbers of mis-alignments/mismatches etc.
 *     """
 *     cdef double totalReads = 0.0             # <<<<<<<<<<<<<<
 *     cdef double readsThisSample = 0.0
 *     cdef double badReadsThisSample = 0.0
 */
  __pyx_v_totalReads = 0.0;

  /* "variantcaller.pyx":283
 *     """
 *     cdef double totalReads = 0.0
 *     cdef double readsThisSample = 0.0             # <<<<<<<<<<<<<<
 *     cdef double badReadsThisSample = 0.0
 *     cdef double totalMismatches = 0.0
 */
  __pyx_v_readsThisSample = 0.0;

  /* "variantcaller.pyx":284
 *     cdef double totalReads = 0.0
 *     cdef double readsThisSample = 0.0
 *     cdef double badReadsThisSample = 0.0             # <<<<<<<<<<<<<<
 *     cdef double totalMismatches = 0.0
 *     cdef double totalAlignmentGaps = 0.0
 */
  __pyx_v_badReadsThisSample = 0.0;

  /* "variantcaller.pyx":285
 *     cdef double readsThisSample = 0.0
 *     cdef double badReadsThisSample = 0.0
 *     cdef double totalMismatches = 0.0             # <<<<<<<<<<<<<<
 *     cdef double totalAlignmentGaps = 0.0
 *     cdef double nImproperReads = 0.0
 */
  __pyx_v_totalMismatches = 0.0;

  /* "variantcaller.pyx":286
 *     cdef double badReadsThisSample = 0.0
 *     cdef double totalMismatches = 0.0
 *     cdef double totalAlignmentGaps = 0.0             # <<<<<<<<<<<<<<
 *     cdef double nImproperReads = 0.0
 *     cdef int qualBinSize = options.qualBinSize
 */
  __pyx_v_totalAlignmentGaps = 0.0;

  /* "variantcaller.pyx":287
 *     cdef double totalMismatches = 0.0
 *     cdef double totalAlignmentGaps = 0.0
 *     cdef double nImproperReads = 0.0             # <<<<<<<<<<<<<<
 *     cdef int qualBinSize = options.qualBinSize
 * 
 */
  __pyx_v_nImproperReads = 0.0;

  /* "variantcaller.pyx":288
 *     cdef double totalAlignmentGaps = 0.0
 *     cdef double nImproperReads = 0.0
 *     cdef int qualBinSize = options.qualBinSize             # <<<<<<<<<<<<<<
 * 
 *     cdef bamReadBuffer theReadBuffer
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qualBinSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_qualBinSize = __pyx_t_2;

  /* "variantcaller.pyx":292
 *     cdef bamReadBuffer theReadBuffer
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(start, end, start, end, refSeq, qualBinSize)
 * 
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 292, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 292, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":293
 * 
 *     for theReadBuffer in readBuffers:
 *         theReadBuffer.setWindowPointers(start, end, start, end, refSeq, qualBinSize)             # <<<<<<<<<<<<<<
 * 
 *     if options.assembleAll:
 */
    ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theReadBuffer->__pyx_vtab)->setWindowPointers(__pyx_v_theReadBuffer, __pyx_v_start, __pyx_v_end, __pyx_v_start, __pyx_v_end, __pyx_v_refSeq, __pyx_v_qualBinSize);

    /* "variantcaller.pyx":292
 *     cdef bamReadBuffer theReadBuffer
 * 
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         theReadBuffer.setWindowPointers(start, end, start, end, refSeq, qualBinSize)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":295
 *         theReadBuffer.setWindowPointers(start, end, start, end, refSeq, qualBinSize)
 * 
 *     if options.assembleAll:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assembleAll); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "variantcaller.pyx":296
 * 
 *     if options.assembleAll:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     # Check all samples, but as soon as we see one which triggers the assembly we
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "variantcaller.pyx":295
 *         theReadBuffer.setWindowPointers(start, end, start, end, refSeq, qualBinSize)
 * 
 *     if options.assembleAll:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "variantcaller.pyx":300
 *     # Check all samples, but as soon as we see one which triggers the assembly we
 *     # return, so we assemble everything is even one of the samples triggers.
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 * 
 *         totalReads += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 300, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 300, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":302
 *     for theReadBuffer in readBuffers:
 * 
 *         totalReads += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)             # <<<<<<<<<<<<<<
 *         readsThisSample = (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 *         badReadsThisSample = (theReadBuffer.badReads.windowEnd - theReadBuffer.badReads.windowStart)
 */
    __pyx_v_totalReads = (__pyx_v_totalReads + (__pyx_v_theReadBuffer->reads->windowEnd - __pyx_v_theReadBuffer->reads->windowStart));

    /* "variantcaller.pyx":303
 * 
 *         totalReads += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 *         readsThisSample = (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)             # <<<<<<<<<<<<<<
 *         badReadsThisSample = (theReadBuffer.badReads.windowEnd - theReadBuffer.badReads.windowStart)
 * 
 */
    __pyx_v_readsThisSample = (__pyx_v_theReadBuffer->reads->windowEnd - __pyx_v_theReadBuffer->reads->windowStart);

    /* "variantcaller.pyx":304
 *         totalReads += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 *         readsThisSample = (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 *         badReadsThisSample = (theReadBuffer.badReads.windowEnd - theReadBuffer.badReads.windowStart)             # <<<<<<<<<<<<<<
 * 
 *         if readsThisSample == 0:
 */
    __pyx_v_badReadsThisSample = (__pyx_v_theReadBuffer->badReads->windowEnd - __pyx_v_theReadBuffer->badReads->windowStart);

    /* "variantcaller.pyx":306
 *         badReadsThisSample = (theReadBuffer.badReads.windowEnd - theReadBuffer.badReads.windowStart)
 * 
 *         if readsThisSample == 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_5 = ((__pyx_v_readsThisSample == 0.0) != 0);
    if (__pyx_t_5) {

      /* "variantcaller.pyx":307
 * 
 *         if readsThisSample == 0:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         totalAlignmentGaps = theReadBuffer.countAlignmentGaps()
 */
      goto __pyx_L6_continue;

      /* "variantcaller.pyx":306
 *         badReadsThisSample = (theReadBuffer.badReads.windowEnd - theReadBuffer.badReads.windowStart)
 * 
 *         if readsThisSample == 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    }

    /* "variantcaller.pyx":309
 *             continue
 * 
 *         totalAlignmentGaps = theReadBuffer.countAlignmentGaps()             # <<<<<<<<<<<<<<
 *         nImproperReads = theReadBuffer.countImproperPairs()
 * 
 */
    __pyx_v_totalAlignmentGaps = ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theReadBuffer->__pyx_vtab)->countAlignmentGaps(__pyx_v_theReadBuffer);

    /* "variantcaller.pyx":310
 * 
 *         totalAlignmentGaps = theReadBuffer.countAlignmentGaps()
 *         nImproperReads = theReadBuffer.countImproperPairs()             # <<<<<<<<<<<<<<
 * 
 *         if totalAlignmentGaps / readsThisSample > 2:
 */
    __pyx_v_nImproperReads = ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theReadBuffer->__pyx_vtab)->countImproperPairs(__pyx_v_theReadBuffer);

    /* "variantcaller.pyx":312
 *         nImproperReads = theReadBuffer.countImproperPairs()
 * 
 *         if totalAlignmentGaps / readsThisSample > 2:             # <<<<<<<<<<<<<<
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s" %(chrom, start, end, readsThisSample, totalAlignmentGaps, totalAlignmentGaps/readsThisSample))
 *             return 1
 */
    __pyx_t_5 = (((__pyx_v_totalAlignmentGaps / __pyx_v_readsThisSample) > 2.0) != 0);
    if (__pyx_t_5) {

      /* "variantcaller.pyx":313
 * 
 *         if totalAlignmentGaps / readsThisSample > 2:
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s" %(chrom, start, end, readsThisSample, totalAlignmentGaps, totalAlignmentGaps/readsThisSample))             # <<<<<<<<<<<<<<
 *             return 1
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_logger); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_readsThisSample); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyFloat_FromDouble(__pyx_v_totalAlignmentGaps); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyFloat_FromDouble((__pyx_v_totalAlignmentGaps / __pyx_v_readsThisSample)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyTuple_New(6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_11);
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":314
 *         if totalAlignmentGaps / readsThisSample > 2:
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s" %(chrom, start, end, readsThisSample, totalAlignmentGaps, totalAlignmentGaps/readsThisSample))
 *             return 1             # <<<<<<<<<<<<<<
 * 
 *         if nImproperReads / (readsThisSample + badReadsThisSample) > 0.1:
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "variantcaller.pyx":312
 *         nImproperReads = theReadBuffer.countImproperPairs()
 * 
 *         if totalAlignmentGaps / readsThisSample > 2:             # <<<<<<<<<<<<<<
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s" %(chrom, start, end, readsThisSample, totalAlignmentGaps, totalAlignmentGaps/readsThisSample))
 *             return 1
 */
    }

    /* "variantcaller.pyx":316
 *             return 1
 * 
 *         if nImproperReads / (readsThisSample + badReadsThisSample) > 0.1:             # <<<<<<<<<<<<<<
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s" %(chrom, start, end, readsThisSample, nImproperReads, nImproperReads/(readsThisSample+badReadsThisSample)))
 *             return 1
 */
    __pyx_t_5 = (((__pyx_v_nImproperReads / (__pyx_v_readsThisSample + __pyx_v_badReadsThisSample)) > 0.1) != 0);
    if (__pyx_t_5) {

      /* "variantcaller.pyx":317
 * 
 *         if nImproperReads / (readsThisSample + badReadsThisSample) > 0.1:
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s" %(chrom, start, end, readsThisSample, nImproperReads, nImproperReads/(readsThisSample+badReadsThisSample)))             # <<<<<<<<<<<<<<
 *             return 1
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = PyFloat_FromDouble(__pyx_v_readsThisSample); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_nImproperReads); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyFloat_FromDouble((__pyx_v_nImproperReads / (__pyx_v_readsThisSample + __pyx_v_badReadsThisSample))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_8);
      __pyx_t_7 = 0;
      __pyx_t_12 = 0;
      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_8);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":318
 *         if nImproperReads / (readsThisSample + badReadsThisSample) > 0.1:
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s" %(chrom, start, end, readsThisSample, nImproperReads, nImproperReads/(readsThisSample+badReadsThisSample)))
 *             return 1             # <<<<<<<<<<<<<<
 * 
 *     # No signal for assembly
 */
      __pyx_r = 1;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "variantcaller.pyx":316
 *             return 1
 * 
 *         if nImproperReads / (readsThisSample + badReadsThisSample) > 0.1:             # <<<<<<<<<<<<<<
 *             logger.info("Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s" %(chrom, start, end, readsThisSample, nImproperReads, nImproperReads/(readsThisSample+badReadsThisSample)))
 *             return 1
 */
    }

    /* "variantcaller.pyx":300
 *     # Check all samples, but as soon as we see one which triggers the assembly we
 *     # return, so we assemble everything is even one of the samples triggers.
 *     for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 * 
 *         totalReads += (theReadBuffer.reads.windowEnd - theReadBuffer.reads.windowStart)
 */
    __pyx_L6_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":321
 * 
 *     # No signal for assembly
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "variantcaller.pyx":276
 * ###################################################################################################
 * 
 * cdef int doWeNeedToAssembleThisRegion(list readBuffers, bytes chrom, int start, int end, options, char* refSeq):             # <<<<<<<<<<<<<<
 *     """
 *     Scan through the specified region, and report whether or not we need to run the assember to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_WriteUnraisable("variantcaller.doWeNeedToAssembleThisRegion", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theReadBuffer);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":325
 * ###################################################################################################
 * 
 * cdef list mergeHaplotypes(list haplotypes, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     Merge haplotypes by sequence. If we see 2 identical haplotypes, then take the one with
 */

static PyObject *__pyx_f_13variantcaller_mergeHaplotypes(PyObject *__pyx_v_haplotypes, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile) {
  PyObject *__pyx_v_sortedHaps = 0;
  PyObject *__pyx_v_mergedHaplotypes = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_lastHap = 0;
  double __pyx_v_priorOne;
  double __pyx_v_priorTwo;
  struct __pyx_obj_7variant_Variant *__pyx_v_theVar = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("mergeHaplotypes", 0);

  /* "variantcaller.pyx":331
 *     possible.
 *     """
 *     cdef list sortedHaps = sorted(haplotypes)             # <<<<<<<<<<<<<<
 *     cdef list mergedHaplotypes = []
 * 
 */
  __pyx_t_2 = PySequence_List(__pyx_v_haplotypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_3 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 331, __pyx_L1_error)
  __pyx_v_sortedHaps = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":332
 *     """
 *     cdef list sortedHaps = sorted(haplotypes)
 *     cdef list mergedHaplotypes = []             # <<<<<<<<<<<<<<
 * 
 *     cdef Haplotype hap = None
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mergedHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":334
 *     cdef list mergedHaplotypes = []
 * 
 *     cdef Haplotype hap = None             # <<<<<<<<<<<<<<
 *     cdef Haplotype lastHap = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_hap = ((struct __pyx_obj_10chaplotype_Haplotype *)Py_None);

  /* "variantcaller.pyx":335
 * 
 *     cdef Haplotype hap = None
 *     cdef Haplotype lastHap = None             # <<<<<<<<<<<<<<
 * 
 *     cdef double priorOne = 1.0
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_lastHap = ((struct __pyx_obj_10chaplotype_Haplotype *)Py_None);

  /* "variantcaller.pyx":337
 *     cdef Haplotype lastHap = None
 * 
 *     cdef double priorOne = 1.0             # <<<<<<<<<<<<<<
 *     cdef double priorTwo = 1.0
 *     cdef Variant theVar
 */
  __pyx_v_priorOne = 1.0;

  /* "variantcaller.pyx":338
 * 
 *     cdef double priorOne = 1.0
 *     cdef double priorTwo = 1.0             # <<<<<<<<<<<<<<
 *     cdef Variant theVar
 * 
 */
  __pyx_v_priorTwo = 1.0;

  /* "variantcaller.pyx":341
 *     cdef Variant theVar
 * 
 *     for hap in sortedHaps:             # <<<<<<<<<<<<<<
 *         #logger.debug(hap)
 * 
 */
  if (unlikely(__pyx_v_sortedHaps == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 341, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_sortedHaps; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 341, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_hap, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "variantcaller.pyx":345
 * 
 *         # Start.
 *         if lastHap is None:             # <<<<<<<<<<<<<<
 *             lastHap = hap
 * 
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_lastHap) == Py_None);
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "variantcaller.pyx":346
 *         # Start.
 *         if lastHap is None:
 *             lastHap = hap             # <<<<<<<<<<<<<<
 * 
 *         # Same as last hap: take hap with least variants
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_hap));
      __Pyx_DECREF_SET(__pyx_v_lastHap, __pyx_v_hap);

      /* "variantcaller.pyx":345
 * 
 *         # Start.
 *         if lastHap is None:             # <<<<<<<<<<<<<<
 *             lastHap = hap
 * 
 */
      goto __pyx_L5;
    }

    /* "variantcaller.pyx":349
 * 
 *         # Same as last hap: take hap with least variants
 *         elif hap == lastHap:             # <<<<<<<<<<<<<<
 * 
 *             logger.debug("Merging haplotypes %s and %s" %(hap, lastHap))
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_hap), ((PyObject *)__pyx_v_lastHap), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {

      /* "variantcaller.pyx":351
 *         elif hap == lastHap:
 * 
 *             logger.debug("Merging haplotypes %s and %s" %(hap, lastHap))             # <<<<<<<<<<<<<<
 * 
 *             # Take the haplotype with the set of variants
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_v_hap));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_hap));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_hap));
      __Pyx_INCREF(((PyObject *)__pyx_v_lastHap));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_lastHap));
      PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_lastHap));
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Merging_haplotypes_s_and_s, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "variantcaller.pyx":355
 *             # Take the haplotype with the set of variants
 *             # which have the lowest combined prior.
 *             priorOne = 1.0             # <<<<<<<<<<<<<<
 *             priorTwo = 1.0
 * 
 */
      __pyx_v_priorOne = 1.0;

      /* "variantcaller.pyx":356
 *             # which have the lowest combined prior.
 *             priorOne = 1.0
 *             priorTwo = 1.0             # <<<<<<<<<<<<<<
 * 
 *             for theVar in lastHap.variants:
 */
      __pyx_v_priorTwo = 1.0;

      /* "variantcaller.pyx":358
 *             priorTwo = 1.0
 * 
 *             for theVar in lastHap.variants:             # <<<<<<<<<<<<<<
 *                 priorOne *= theVar.calculatePrior(refFile)
 * 
 */
      if (unlikely(__pyx_v_lastHap->variants == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 358, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_v_lastHap->variants; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
      for (;;) {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 358, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 358, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_theVar, ((struct __pyx_obj_7variant_Variant *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "variantcaller.pyx":359
 * 
 *             for theVar in lastHap.variants:
 *                 priorOne *= theVar.calculatePrior(refFile)             # <<<<<<<<<<<<<<
 * 
 *             for theVar in hap.variants:
 */
        __pyx_v_priorOne = (__pyx_v_priorOne * ((struct __pyx_vtabstruct_7variant_Variant *)__pyx_v_theVar->__pyx_vtab)->calculatePrior(__pyx_v_theVar, __pyx_v_refFile));

        /* "variantcaller.pyx":358
 *             priorTwo = 1.0
 * 
 *             for theVar in lastHap.variants:             # <<<<<<<<<<<<<<
 *                 priorOne *= theVar.calculatePrior(refFile)
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "variantcaller.pyx":361
 *                 priorOne *= theVar.calculatePrior(refFile)
 * 
 *             for theVar in hap.variants:             # <<<<<<<<<<<<<<
 *                 priorTwo *= theVar.calculatePrior(refFile)
 * 
 */
      if (unlikely(__pyx_v_hap->variants == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 361, __pyx_L1_error)
      }
      __pyx_t_2 = __pyx_v_hap->variants; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0;
      for (;;) {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 361, __pyx_L1_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 361, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_theVar, ((struct __pyx_obj_7variant_Variant *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "variantcaller.pyx":362
 * 
 *             for theVar in hap.variants:
 *                 priorTwo *= theVar.calculatePrior(refFile)             # <<<<<<<<<<<<<<
 * 
 *             # lastHap has better prior. Keep that one
 */
        __pyx_v_priorTwo = (__pyx_v_priorTwo * ((struct __pyx_vtabstruct_7variant_Variant *)__pyx_v_theVar->__pyx_vtab)->calculatePrior(__pyx_v_theVar, __pyx_v_refFile));

        /* "variantcaller.pyx":361
 *                 priorOne *= theVar.calculatePrior(refFile)
 * 
 *             for theVar in hap.variants:             # <<<<<<<<<<<<<<
 *                 priorTwo *= theVar.calculatePrior(refFile)
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "variantcaller.pyx":365
 * 
 *             # lastHap has better prior. Keep that one
 *             if priorOne > priorTwo:             # <<<<<<<<<<<<<<
 *                 pass
 * 
 */
      __pyx_t_6 = ((__pyx_v_priorOne > __pyx_v_priorTwo) != 0);
      if (__pyx_t_6) {
        goto __pyx_L10;
      }

      /* "variantcaller.pyx":369
 * 
 *             # hap has better prior. Keep that one
 *             elif priorTwo > priorOne:             # <<<<<<<<<<<<<<
 *                 lastHap = hap
 * 
 */
      __pyx_t_6 = ((__pyx_v_priorTwo > __pyx_v_priorOne) != 0);
      if (__pyx_t_6) {

        /* "variantcaller.pyx":370
 *             # hap has better prior. Keep that one
 *             elif priorTwo > priorOne:
 *                 lastHap = hap             # <<<<<<<<<<<<<<
 * 
 *             # Priors are close or the same. Doesn't really matter
 */
        __Pyx_INCREF(((PyObject *)__pyx_v_hap));
        __Pyx_DECREF_SET(__pyx_v_lastHap, __pyx_v_hap);

        /* "variantcaller.pyx":369
 * 
 *             # hap has better prior. Keep that one
 *             elif priorTwo > priorOne:             # <<<<<<<<<<<<<<
 *                 lastHap = hap
 * 
 */
        goto __pyx_L10;
      }

      /* "variantcaller.pyx":374
 *             # Priors are close or the same. Doesn't really matter
 *             else:
 *                 pass             # <<<<<<<<<<<<<<
 * 
 *         # Add whichever hap we kept to merged list
 */
      /*else*/ {
      }
      __pyx_L10:;

      /* "variantcaller.pyx":349
 * 
 *         # Same as last hap: take hap with least variants
 *         elif hap == lastHap:             # <<<<<<<<<<<<<<
 * 
 *             logger.debug("Merging haplotypes %s and %s" %(hap, lastHap))
 */
      goto __pyx_L5;
    }

    /* "variantcaller.pyx":378
 *         # Add whichever hap we kept to merged list
 *         else:
 *             mergedHaplotypes.append(lastHap)             # <<<<<<<<<<<<<<
 *             lastHap = hap
 * 
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_mergedHaplotypes, ((PyObject *)__pyx_v_lastHap)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 378, __pyx_L1_error)

      /* "variantcaller.pyx":379
 *         else:
 *             mergedHaplotypes.append(lastHap)
 *             lastHap = hap             # <<<<<<<<<<<<<<
 * 
 *     if lastHap is not None:
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_hap));
      __Pyx_DECREF_SET(__pyx_v_lastHap, __pyx_v_hap);
    }
    __pyx_L5:;

    /* "variantcaller.pyx":341
 *     cdef Variant theVar
 * 
 *     for hap in sortedHaps:             # <<<<<<<<<<<<<<
 *         #logger.debug(hap)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":381
 *             lastHap = hap
 * 
 *     if lastHap is not None:             # <<<<<<<<<<<<<<
 *         mergedHaplotypes.append(lastHap)
 * 
 */
  __pyx_t_6 = (((PyObject *)__pyx_v_lastHap) != Py_None);
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "variantcaller.pyx":382
 * 
 *     if lastHap is not None:
 *         mergedHaplotypes.append(lastHap)             # <<<<<<<<<<<<<<
 * 
 *     #logger.debug("")
 */
    __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_mergedHaplotypes, ((PyObject *)__pyx_v_lastHap)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 382, __pyx_L1_error)

    /* "variantcaller.pyx":381
 *             lastHap = hap
 * 
 *     if lastHap is not None:             # <<<<<<<<<<<<<<
 *         mergedHaplotypes.append(lastHap)
 * 
 */
  }

  /* "variantcaller.pyx":390
 *     #logger.debug("")
 * 
 *     return mergedHaplotypes             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_mergedHaplotypes);
  __pyx_r = __pyx_v_mergedHaplotypes;
  goto __pyx_L0;

  /* "variantcaller.pyx":325
 * ###################################################################################################
 * 
 * cdef list mergeHaplotypes(list haplotypes, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     Merge haplotypes by sequence. If we see 2 identical haplotypes, then take the one with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("variantcaller.mergeHaplotypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sortedHaps);
  __Pyx_XDECREF(__pyx_v_mergedHaplotypes);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap);
  __Pyx_XDECREF((PyObject *)__pyx_v_lastHap);
  __Pyx_XDECREF((PyObject *)__pyx_v_theVar);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":412
 * ###################################################################################################
 * 
 * cdef list generateVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a list of variants, based on BAM file data and any input VCFs, in the specified region,
 */

static PyObject *__pyx_f_13variantcaller_generateVariantsInRegion(PyObject *__pyx_v_chrom, int __pyx_v_start, int __pyx_v_end, CYTHON_UNUSED PyObject *__pyx_v_bamFiles, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_options, CYTHON_UNUSED PyObject *__pyx_v_windowGenerator, CYTHON_UNUSED PyObject *__pyx_v_outputFile, CYTHON_UNUSED PyObject *__pyx_v_vcf, PyObject *__pyx_v_readBuffers) {
  struct __pyx_obj_7variant_VariantCandidateGenerator *__pyx_v_varCandGen = 0;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theReadBuffer = 0;
  PyObject *__pyx_v_rawBamVariants = 0;
  PyObject *__pyx_v_vcfFileVariants = 0;
  PyObject *__pyx_v_assemblerVariants = 0;
  PyObject *__pyx_v_refSequenceBytes = 0;
  char *__pyx_v_refSequence;
  struct __pyx_obj_7variant_Variant *__pyx_v_v = 0;
  int __pyx_v_maxReadLength;
  int __pyx_v_longestRead;
  CYTHON_UNUSED int __pyx_v_minSampleCoverage;
  double __pyx_v_minVarFreq;
  PyObject *__pyx_v_totalReadsInRegion = NULL;
  PyObject *__pyx_v_totalBufferSizeInRegion = NULL;
  PyObject *__pyx_v_totalSeqQualSize = NULL;
  struct __pyx_obj_7variant_VariantCandidateGenerator *__pyx_v_allSampleVarCandGen = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_key = NULL;
  double __pyx_v_varReadFrac;
  PyObject *__pyx_v_variantSource = NULL;
  PyObject *__pyx_v_assemRegionShift = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_assemIndex = NULL;
  PyObject *__pyx_v_assemStart = NULL;
  PyObject *__pyx_v_assemEnd = NULL;
  PyObject *__pyx_v_refStart = NULL;
  PyObject *__pyx_v_refEnd = NULL;
  int __pyx_v_needToAssemble;
  PyObject *__pyx_v_allVarCands = 0;
  PyObject *__pyx_v_leftNormVars = 0;
  PyObject *__pyx_v_filteredVariants = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  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;
  Py_ssize_t __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  long __pyx_t_22;
  PyObject *(*__pyx_t_23)(PyObject *);
  PY_LONG_LONG __pyx_t_24;
  PY_LONG_LONG __pyx_t_25;
  int __pyx_t_26;
  int __pyx_t_27;
  __Pyx_RefNannySetupContext("generateVariantsInRegion", 0);

  /* "variantcaller.pyx":419
 *     cdef VariantCandidateGenerator varCandGen
 *     cdef bamReadBuffer theReadBuffer
 *     cdef list rawBamVariants = []             # <<<<<<<<<<<<<<
 *     cdef list vcfFileVariants = []
 *     cdef list assemblerVariants = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rawBamVariants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":420
 *     cdef bamReadBuffer theReadBuffer
 *     cdef list rawBamVariants = []
 *     cdef list vcfFileVariants = []             # <<<<<<<<<<<<<<
 *     cdef list assemblerVariants = []
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start,end)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vcfFileVariants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":421
 *     cdef list rawBamVariants = []
 *     cdef list vcfFileVariants = []
 *     cdef list assemblerVariants = []             # <<<<<<<<<<<<<<
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start,end)
 *     cdef char* refSequence = refSequenceBytes
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_assemblerVariants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":422
 *     cdef list vcfFileVariants = []
 *     cdef list assemblerVariants = []
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start,end)             # <<<<<<<<<<<<<<
 *     cdef char* refSequence = refSequenceBytes
 *     cdef Variant v
 */
  __pyx_t_1 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_refSequenceBytes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":423
 *     cdef list assemblerVariants = []
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start,end)
 *     cdef char* refSequence = refSequenceBytes             # <<<<<<<<<<<<<<
 *     cdef Variant v
 *     cdef int maxReadLength = options.rlen
 */
  if (unlikely(__pyx_v_refSequenceBytes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 423, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_refSequenceBytes); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error)
  __pyx_v_refSequence = __pyx_t_2;

  /* "variantcaller.pyx":425
 *     cdef char* refSequence = refSequenceBytes
 *     cdef Variant v
 *     cdef int maxReadLength = options.rlen             # <<<<<<<<<<<<<<
 *     cdef int longestRead = 0
 *     cdef int minSampleCoverage = -1
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_maxReadLength = __pyx_t_3;

  /* "variantcaller.pyx":426
 *     cdef Variant v
 *     cdef int maxReadLength = options.rlen
 *     cdef int longestRead = 0             # <<<<<<<<<<<<<<
 *     cdef int minSampleCoverage = -1
 *     cdef double minVarFreq = options.minVarFreq
 */
  __pyx_v_longestRead = 0;

  /* "variantcaller.pyx":427
 *     cdef int maxReadLength = options.rlen
 *     cdef int longestRead = 0
 *     cdef int minSampleCoverage = -1             # <<<<<<<<<<<<<<
 *     cdef double minVarFreq = options.minVarFreq
 * 
 */
  __pyx_v_minSampleCoverage = -1;

  /* "variantcaller.pyx":428
 *     cdef int longestRead = 0
 *     cdef int minSampleCoverage = -1
 *     cdef double minVarFreq = options.minVarFreq             # <<<<<<<<<<<<<<
 * 
 *     if options.verbosity >= 3:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minVarFreq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_minVarFreq = __pyx_t_4;

  /* "variantcaller.pyx":430
 *     cdef double minVarFreq = options.minVarFreq
 * 
 *     if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *         totalReadsInRegion,totalBufferSizeInRegion,totalSeqQualSize = countTotalReadsInRegion(readBuffers)
 *         logger.debug("There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s" %(totalReadsInRegion, totalBufferSizeInRegion, totalSeqQualSize, chrom, start, end))
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {

    /* "variantcaller.pyx":431
 * 
 *     if options.verbosity >= 3:
 *         totalReadsInRegion,totalBufferSizeInRegion,totalSeqQualSize = countTotalReadsInRegion(readBuffers)             # <<<<<<<<<<<<<<
 *         logger.debug("There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s" %(totalReadsInRegion, totalBufferSizeInRegion, totalSeqQualSize, chrom, start, end))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_countTotalReadsInRegion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_readBuffers) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_readBuffers);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 431, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(0, 431, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 431, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_totalReadsInRegion = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_totalBufferSizeInRegion = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_totalSeqQualSize = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "variantcaller.pyx":432
 *     if options.verbosity >= 3:
 *         totalReadsInRegion,totalBufferSizeInRegion,totalSeqQualSize = countTotalReadsInRegion(readBuffers)
 *         logger.debug("There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s" %(totalReadsInRegion, totalBufferSizeInRegion, totalSeqQualSize, chrom, start, end))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_logger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyTuple_New(6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_totalReadsInRegion);
    __Pyx_GIVEREF(__pyx_v_totalReadsInRegion);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_totalReadsInRegion);
    __Pyx_INCREF(__pyx_v_totalBufferSizeInRegion);
    __Pyx_GIVEREF(__pyx_v_totalBufferSizeInRegion);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_totalBufferSizeInRegion);
    __Pyx_INCREF(__pyx_v_totalSeqQualSize);
    __Pyx_GIVEREF(__pyx_v_totalSeqQualSize);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_totalSeqQualSize);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 4, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_1);
    __pyx_t_8 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_There_are_s_reads_buffer_size_s, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 432, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "variantcaller.pyx":430
 *     cdef double minVarFreq = options.minVarFreq
 * 
 *     if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *         totalReadsInRegion,totalBufferSizeInRegion,totalSeqQualSize = countTotalReadsInRegion(readBuffers)
 *         logger.debug("There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s" %(totalReadsInRegion, totalBufferSizeInRegion, totalSeqQualSize, chrom, start, end))
 */
  }

  /* "variantcaller.pyx":437
 *     # Generate initial variant candidate list from BAM files. Do this always, so we
 *     # get read-counts for variants in the BAMs
 *     if options.getVariantsFromBAMs:             # <<<<<<<<<<<<<<
 * 
 *         allSampleVarCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_getVariantsFromBAMs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {

    /* "variantcaller.pyx":439
 *     if options.getVariantsFromBAMs:
 * 
 *         allSampleVarCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)             # <<<<<<<<<<<<<<
 * 
 *         # We want to check all BAMs and accumulate data before filtering
 */
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minMapQual); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minFlank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minBaseQual); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_maxReadLength); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_genSNPs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_genIndels); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
    PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_v_refFile));
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_t_11);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_v_options);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_15, 8, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_15, 9, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_15, 10, __pyx_t_14);
    __pyx_t_1 = 0;
    __pyx_t_7 = 0;
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7variant_VariantCandidateGenerator), __pyx_t_15, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_allSampleVarCandGen = ((struct __pyx_obj_7variant_VariantCandidateGenerator *)__pyx_t_14);
    __pyx_t_14 = 0;

    /* "variantcaller.pyx":442
 * 
 *         # We want to check all BAMs and accumulate data before filtering
 *         for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 * 
 *             # Make generator per sample
 */
    if (unlikely(__pyx_v_readBuffers == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 442, __pyx_L1_error)
    }
    __pyx_t_14 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_14); __pyx_t_16 = 0;
    for (;;) {
      if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_14)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_15); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 442, __pyx_L1_error)
      #else
      __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      #endif
      if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 442, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_theReadBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_15));
      __pyx_t_15 = 0;

      /* "variantcaller.pyx":445
 * 
 *             # Make generator per sample
 *             varCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)             # <<<<<<<<<<<<<<
 * 
 *             if theReadBuffer.reads.getLengthOfLongestRead() > longestRead:
 */
      __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13);
      __pyx_t_15 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minMapQual); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minFlank); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minBaseQual); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxReads); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_maxReadLength); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_genSNPs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_genIndels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = PyTuple_New(11); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_12);
      __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
      PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)__pyx_v_refFile));
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_17, 5, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_17, 6, __pyx_t_9);
      __Pyx_INCREF(__pyx_v_options);
      __Pyx_GIVEREF(__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_17, 7, __pyx_v_options);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_17, 8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_17, 9, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_17, 10, __pyx_t_1);
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      __pyx_t_15 = 0;
      __pyx_t_11 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7variant_VariantCandidateGenerator), __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF_SET(__pyx_v_varCandGen, ((struct __pyx_obj_7variant_VariantCandidateGenerator *)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "variantcaller.pyx":447
 *             varCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)
 * 
 *             if theReadBuffer.reads.getLengthOfLongestRead() > longestRead:             # <<<<<<<<<<<<<<
 *                 longestRead = theReadBuffer.reads.getLengthOfLongestRead()
 * 
 */
      __pyx_t_6 = ((((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getLengthOfLongestRead(__pyx_v_theReadBuffer->reads) > __pyx_v_longestRead) != 0);
      if (__pyx_t_6) {

        /* "variantcaller.pyx":448
 * 
 *             if theReadBuffer.reads.getLengthOfLongestRead() > longestRead:
 *                 longestRead = theReadBuffer.reads.getLengthOfLongestRead()             # <<<<<<<<<<<<<<
 * 
 *             varCandGen.addCandidatesFromReads(theReadBuffer.reads.array, theReadBuffer.reads.array + theReadBuffer.reads.getSize())
 */
        __pyx_v_longestRead = ((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getLengthOfLongestRead(__pyx_v_theReadBuffer->reads);

        /* "variantcaller.pyx":447
 *             varCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)
 * 
 *             if theReadBuffer.reads.getLengthOfLongestRead() > longestRead:             # <<<<<<<<<<<<<<
 *                 longestRead = theReadBuffer.reads.getLengthOfLongestRead()
 * 
 */
      }

      /* "variantcaller.pyx":450
 *                 longestRead = theReadBuffer.reads.getLengthOfLongestRead()
 * 
 *             varCandGen.addCandidatesFromReads(theReadBuffer.reads.array, theReadBuffer.reads.array + theReadBuffer.reads.getSize())             # <<<<<<<<<<<<<<
 *             #varCandGen.addCandidatesFromReads(theReadBuffer.badReads.array, theReadBuffer.badReads.array + theReadBuffer.badReads.getSize())
 *             if options.verbosity >= 3:
 */
      ((struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *)__pyx_v_varCandGen->__pyx_vtab)->addCandidatesFromReads(__pyx_v_varCandGen, __pyx_v_theReadBuffer->reads->array, (__pyx_v_theReadBuffer->reads->array + ((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->reads)));

      /* "variantcaller.pyx":452
 *             varCandGen.addCandidatesFromReads(theReadBuffer.reads.array, theReadBuffer.reads.array + theReadBuffer.reads.getSize())
 *             #varCandGen.addCandidatesFromReads(theReadBuffer.badReads.array, theReadBuffer.badReads.array + theReadBuffer.badReads.getSize())
 *             if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.debug("Processed sample %s. Detected %s unfiltered variant candidates so far" %(theReadBuffer.sample, len(varCandGen.variantHeap)))
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 452, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (__pyx_t_6) {

        /* "variantcaller.pyx":453
 *             #varCandGen.addCandidatesFromReads(theReadBuffer.badReads.array, theReadBuffer.badReads.array + theReadBuffer.badReads.getSize())
 *             if options.verbosity >= 3:
 *                 logger.debug("Processed sample %s. Detected %s unfiltered variant candidates so far" %(theReadBuffer.sample, len(varCandGen.variantHeap)))             # <<<<<<<<<<<<<<
 * 
 *             ## Filter by per-sample coverage on each file. No variant should be kept unless it has >= coverageThreshold supporting reads
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __pyx_v_varCandGen->variantHeap;
        __Pyx_INCREF(__pyx_t_1);
        if (unlikely(__pyx_t_1 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(0, 453, __pyx_L1_error)
        }
        __pyx_t_18 = PyDict_Size(__pyx_t_1); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_v_theReadBuffer->sample);
        __Pyx_GIVEREF(__pyx_v_theReadBuffer->sample);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_theReadBuffer->sample);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Processed_sample_s_Detected_s_un, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_17 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

        /* "variantcaller.pyx":452
 *             varCandGen.addCandidatesFromReads(theReadBuffer.reads.array, theReadBuffer.reads.array + theReadBuffer.reads.getSize())
 *             #varCandGen.addCandidatesFromReads(theReadBuffer.badReads.array, theReadBuffer.badReads.array + theReadBuffer.badReads.getSize())
 *             if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.debug("Processed sample %s. Detected %s unfiltered variant candidates so far" %(theReadBuffer.sample, len(varCandGen.variantHeap)))
 * 
 */
      }

      /* "variantcaller.pyx":457
 *             ## Filter by per-sample coverage on each file. No variant should be kept unless it has >= coverageThreshold supporting reads
 *             ## in at least one sample
 *             for key,v in varCandGen.variantHeap.iteritems():             # <<<<<<<<<<<<<<
 *                 varReadFrac = computeVariantReadSupportFrac(v, theReadBuffer)
 *                 #logger.info("Var frac for variant %s is %s" %(v, varReadFrac))
 */
      __pyx_t_18 = 0;
      if (unlikely(__pyx_v_varCandGen->variantHeap == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
        __PYX_ERR(0, 457, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_varCandGen->variantHeap, 1, __pyx_n_s_iteritems, (&__pyx_t_19), (&__pyx_t_3)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_17);
      __pyx_t_17 = __pyx_t_7;
      __pyx_t_7 = 0;
      while (1) {
        __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_17, __pyx_t_19, &__pyx_t_18, &__pyx_t_7, &__pyx_t_1, NULL, __pyx_t_3);
        if (unlikely(__pyx_t_20 == 0)) break;
        if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(0, 457, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_1);
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 457, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_7);
        __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "variantcaller.pyx":458
 *             ## in at least one sample
 *             for key,v in varCandGen.variantHeap.iteritems():
 *                 varReadFrac = computeVariantReadSupportFrac(v, theReadBuffer)             # <<<<<<<<<<<<<<
 *                 #logger.info("Var frac for variant %s is %s" %(v, varReadFrac))
 * 
 */
        __pyx_v_varReadFrac = __pyx_f_13variantFilter_computeVariantReadSupportFrac(__pyx_v_v, __pyx_v_theReadBuffer);

        /* "variantcaller.pyx":462
 * 
 *                 # Add to total list, merging if necessary
 *                 if varReadFrac >= minVarFreq:             # <<<<<<<<<<<<<<
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 # Always add indels
 */
        __pyx_t_6 = ((__pyx_v_varReadFrac >= __pyx_v_minVarFreq) != 0);
        if (__pyx_t_6) {

          /* "variantcaller.pyx":463
 *                 # Add to total list, merging if necessary
 *                 if varReadFrac >= minVarFreq:
 *                     allSampleVarCandGen.addVariantToList(v)             # <<<<<<<<<<<<<<
 *                 # Always add indels
 *                 elif v.nAdded != v.nRemoved:
 */
          ((struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *)__pyx_v_allSampleVarCandGen->__pyx_vtab)->addVariantToList(__pyx_v_allSampleVarCandGen, __pyx_v_v);

          /* "variantcaller.pyx":462
 * 
 *                 # Add to total list, merging if necessary
 *                 if varReadFrac >= minVarFreq:             # <<<<<<<<<<<<<<
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 # Always add indels
 */
          goto __pyx_L13;
        }

        /* "variantcaller.pyx":465
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 # Always add indels
 *                 elif v.nAdded != v.nRemoved:             # <<<<<<<<<<<<<<
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 else:
 */
        __pyx_t_6 = ((__pyx_v_v->nAdded != __pyx_v_v->nRemoved) != 0);
        if (__pyx_t_6) {

          /* "variantcaller.pyx":466
 *                 # Always add indels
 *                 elif v.nAdded != v.nRemoved:
 *                     allSampleVarCandGen.addVariantToList(v)             # <<<<<<<<<<<<<<
 *                 else:
 *                     continue
 */
          ((struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *)__pyx_v_allSampleVarCandGen->__pyx_vtab)->addVariantToList(__pyx_v_allSampleVarCandGen, __pyx_v_v);

          /* "variantcaller.pyx":465
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 # Always add indels
 *                 elif v.nAdded != v.nRemoved:             # <<<<<<<<<<<<<<
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 else:
 */
          goto __pyx_L13;
        }

        /* "variantcaller.pyx":468
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 else:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             if options.verbosity >= 3:
 */
        /*else*/ {
          goto __pyx_L11_continue;
        }
        __pyx_L13:;
        __pyx_L11_continue:;
      }
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

      /* "variantcaller.pyx":470
 *                     continue
 * 
 *             if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.debug("This reduces to %s candidates after coverage-filtering" %(len(varCandGen.variantHeap)))
 * 
 */
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 470, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_17, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 470, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_6) {

        /* "variantcaller.pyx":471
 * 
 *             if options.verbosity >= 3:
 *                 logger.debug("This reduces to %s candidates after coverage-filtering" %(len(varCandGen.variantHeap)))             # <<<<<<<<<<<<<<
 * 
 *         # Add candidates from all samples to list
 */
        __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_logger); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = __pyx_v_varCandGen->variantHeap;
        __Pyx_INCREF(__pyx_t_17);
        if (unlikely(__pyx_t_17 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(0, 471, __pyx_L1_error)
        }
        __pyx_t_19 = PyDict_Size(__pyx_t_17); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_This_reduces_to_s_candidates_aft, __pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_17, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "variantcaller.pyx":470
 *                     continue
 * 
 *             if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.debug("This reduces to %s candidates after coverage-filtering" %(len(varCandGen.variantHeap)))
 * 
 */
      }

      /* "variantcaller.pyx":442
 * 
 *         # We want to check all BAMs and accumulate data before filtering
 *         for theReadBuffer in readBuffers:             # <<<<<<<<<<<<<<
 * 
 *             # Make generator per sample
 */
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "variantcaller.pyx":474
 * 
 *         # Add candidates from all samples to list
 *         rawBamVariants.extend(allSampleVarCandGen.getCandidates(0))             # <<<<<<<<<<<<<<
 * 
 *         # options.rlen over-rides the data, if set, otherwise we use the longest read
 */
    __pyx_t_14 = ((struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *)__pyx_v_allSampleVarCandGen->__pyx_vtab)->getCandidates(__pyx_v_allSampleVarCandGen, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_21 = __Pyx_PyList_Extend(__pyx_v_rawBamVariants, __pyx_t_14); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "variantcaller.pyx":478
 *         # options.rlen over-rides the data, if set, otherwise we use the longest read
 *         # in the data
 *         if longestRead > 0:             # <<<<<<<<<<<<<<
 *             if longestRead >= options.maxSize:
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 */
    __pyx_t_6 = ((__pyx_v_longestRead > 0) != 0);
    if (__pyx_t_6) {

      /* "variantcaller.pyx":479
 *         # in the data
 *         if longestRead > 0:
 *             if longestRead >= options.maxSize:             # <<<<<<<<<<<<<<
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")
 */
      __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_longestRead); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_14, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_6) {

        /* "variantcaller.pyx":480
 *         if longestRead > 0:
 *             if longestRead >= options.maxSize:
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))             # <<<<<<<<<<<<<<
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")
 *                 logger.warning("Increase --maxSize if you want longer reads to be used for determining widow boundaries")
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_longestRead); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_5);
        __pyx_t_1 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Found_very_long_read_s_bases_Cap, __pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_7 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_17, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "variantcaller.pyx":481
 *             if longestRead >= options.maxSize:
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")             # <<<<<<<<<<<<<<
 *                 logger.warning("Increase --maxSize if you want longer reads to be used for determining widow boundaries")
 *                 logger.warning("But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes")
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_7 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_14, __pyx_kp_s_Longer_reads_will_be_used_for_al) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_Longer_reads_will_be_used_for_al);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "variantcaller.pyx":482
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")
 *                 logger.warning("Increase --maxSize if you want longer reads to be used for determining widow boundaries")             # <<<<<<<<<<<<<<
 *                 logger.warning("But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes")
 *                 options.rlen = options.maxSize
 */
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_7 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_5, __pyx_kp_s_Increase_maxSize_if_you_want_lon) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_Increase_maxSize_if_you_want_lon);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "variantcaller.pyx":483
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")
 *                 logger.warning("Increase --maxSize if you want longer reads to be used for determining widow boundaries")
 *                 logger.warning("But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes")             # <<<<<<<<<<<<<<
 *                 options.rlen = options.maxSize
 *             else:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_7 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_14, __pyx_kp_s_But_keep_maxSize_below_5000_othe) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_But_keep_maxSize_below_5000_othe);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "variantcaller.pyx":484
 *                 logger.warning("Increase --maxSize if you want longer reads to be used for determining widow boundaries")
 *                 logger.warning("But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes")
 *                 options.rlen = options.maxSize             # <<<<<<<<<<<<<<
 *             else:
 *                 options.rlen = longestRead
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 484, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s_rlen, __pyx_t_7) < 0) __PYX_ERR(0, 484, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "variantcaller.pyx":479
 *         # in the data
 *         if longestRead > 0:
 *             if longestRead >= options.maxSize:             # <<<<<<<<<<<<<<
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 *                 logger.warning("Longer reads will be used for alignments but not to determine window boundaries")
 */
        goto __pyx_L16;
      }

      /* "variantcaller.pyx":486
 *                 options.rlen = options.maxSize
 *             else:
 *                 options.rlen = longestRead             # <<<<<<<<<<<<<<
 * 
 *     maxReadLength = options.rlen
 */
      /*else*/ {
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_longestRead); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s_rlen, __pyx_t_7) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_L16:;

      /* "variantcaller.pyx":478
 *         # options.rlen over-rides the data, if set, otherwise we use the longest read
 *         # in the data
 *         if longestRead > 0:             # <<<<<<<<<<<<<<
 *             if longestRead >= options.maxSize:
 *                 logger.warning("Found very long read (%s bases). Capping max read length at --maxSize (%s)." %(longestRead, options.maxSize))
 */
    }

    /* "variantcaller.pyx":437
 *     # Generate initial variant candidate list from BAM files. Do this always, so we
 *     # get read-counts for variants in the BAMs
 *     if options.getVariantsFromBAMs:             # <<<<<<<<<<<<<<
 * 
 *         allSampleVarCandGen = VariantCandidateGenerator((chrom,start,end), refFile, options.minMapQual, options.minFlank, options.minBaseQual, options.maxReads, maxReadLength, options, options.verbosity, options.genSNPs, options.genIndels)
 */
  }

  /* "variantcaller.pyx":488
 *                 options.rlen = longestRead
 * 
 *     maxReadLength = options.rlen             # <<<<<<<<<<<<<<
 * 
 *     # Get variants from external VCF source file
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_maxReadLength = __pyx_t_3;

  /* "variantcaller.pyx":491
 * 
 *     # Get variants from external VCF source file
 *     if options.sourceFile:             # <<<<<<<<<<<<<<
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options)
 *         vcfFileVariants.extend(variantSource.Variants(chrom,start,end))
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_6) {

    /* "variantcaller.pyx":492
 *     # Get variants from external VCF source file
 *     if options.sourceFile:
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options)             # <<<<<<<<<<<<<<
 *         vcfFileVariants.extend(variantSource.Variants(chrom,start,end))
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_variantutils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_VariantCandidateReader); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_17 = NULL;
    __pyx_t_3 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_3 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_5, __pyx_v_options};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_5, __pyx_v_options};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_17) {
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_17); __pyx_t_17 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_3, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_options);
      __Pyx_GIVEREF(__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_3, __pyx_v_options);
      __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_variantSource = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "variantcaller.pyx":493
 *     if options.sourceFile:
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options)
 *         vcfFileVariants.extend(variantSource.Variants(chrom,start,end))             # <<<<<<<<<<<<<<
 * 
 *     # Get variants from assembler
 */
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_variantSource, __pyx_n_s_Variants); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_17 = NULL;
    __pyx_t_3 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_17)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_3 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_v_chrom, __pyx_t_1, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_3, 3+__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 493, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_v_chrom, __pyx_t_1, __pyx_t_5};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_3, 3+__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 493, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_17) {
        __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_17); __pyx_t_17 = NULL;
      }
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_3, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_3, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_3, __pyx_t_5);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_21 = __Pyx_PyList_Extend(__pyx_v_vcfFileVariants, __pyx_t_7); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 493, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "variantcaller.pyx":491
 * 
 *     # Get variants from external VCF source file
 *     if options.sourceFile:             # <<<<<<<<<<<<<<
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options)
 *         vcfFileVariants.extend(variantSource.Variants(chrom,start,end))
 */
  }

  /* "variantcaller.pyx":496
 * 
 *     # Get variants from assembler
 *     if options.assemble:             # <<<<<<<<<<<<<<
 * 
 *         assemRegionShift = max(100, min(1000, options.assemblyRegionSize//2))
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemble); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_6) {

    /* "variantcaller.pyx":498
 *     if options.assemble:
 * 
 *         assemRegionShift = max(100, min(1000, options.assemblyRegionSize//2))             # <<<<<<<<<<<<<<
 *         #assemRegionShift = max(100, min(1000, options.assemblyRegionSize//4))
 *         logger.debug("Assembly region windows will be tiled. Each region will start %s bases after the last one" %(assemRegionShift))
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblyRegionSize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_14 = __Pyx_PyInt_FloorDivideObjC(__pyx_t_7, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_22 = 0x3E8;
    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_14, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_7 = __pyx_t_14;
    } else {
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_14 = __pyx_t_7;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_22 = 0x64;
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_14, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 498, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_7 = __pyx_t_14;
    } else {
      __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __pyx_t_9;
      __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_assemRegionShift = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "variantcaller.pyx":500
 *         assemRegionShift = max(100, min(1000, options.assemblyRegionSize//2))
 *         #assemRegionShift = max(100, min(1000, options.assemblyRegionSize//4))
 *         logger.debug("Assembly region windows will be tiled. Each region will start %s bases after the last one" %(assemRegionShift))             # <<<<<<<<<<<<<<
 * 
 *         for assemIndex,assemStart in enumerate(xrange(start, end, assemRegionShift)):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logger); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Assembly_region_windows_will_be, __pyx_v_assemRegionShift); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_14 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "variantcaller.pyx":502
 *         logger.debug("Assembly region windows will be tiled. Each region will start %s bases after the last one" %(assemRegionShift))
 * 
 *         for assemIndex,assemStart in enumerate(xrange(start, end, assemRegionShift)):             # <<<<<<<<<<<<<<
 *         #for assemIndex,assemStart in enumerate(xrange(start, end, options.assemblyRegionSize//2)):
 *         #for assemIndex,assemStart in enumerate(xrange(start, end, options.assemblyRegionSize)):
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_14 = __pyx_int_0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_assemRegionShift);
    __Pyx_GIVEREF(__pyx_v_assemRegionShift);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_assemRegionShift);
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); __pyx_t_16 = 0;
      __pyx_t_23 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_23 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 502, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_23)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 502, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 502, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_23(__pyx_t_5);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 502, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __Pyx_XDECREF_SET(__pyx_v_assemStart, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_XDECREF_SET(__pyx_v_assemIndex, __pyx_t_14);
      __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_14, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_14);
      __pyx_t_14 = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "variantcaller.pyx":506
 *         #for assemIndex,assemStart in enumerate(xrange(start, end, options.assemblyRegionSize)):
 * 
 *             assemEnd = min(assemStart + options.assemblyRegionSize, end)             # <<<<<<<<<<<<<<
 *             refStart = max(0, assemStart-options.assemblyRegionSize)
 *             refEnd = assemEnd+options.assemblyRegionSize
 */
      __pyx_t_3 = __pyx_v_end;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblyRegionSize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyNumber_Add(__pyx_v_assemStart, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_17 = PyObject_RichCompare(__pyx_t_1, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 506, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 506, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (__pyx_t_6) {
        __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_t_3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_7 = __pyx_t_17;
        __pyx_t_17 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_9);
        __pyx_t_7 = __pyx_t_9;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_assemEnd, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "variantcaller.pyx":507
 * 
 *             assemEnd = min(assemStart + options.assemblyRegionSize, end)
 *             refStart = max(0, assemStart-options.assemblyRegionSize)             # <<<<<<<<<<<<<<
 *             refEnd = assemEnd+options.assemblyRegionSize
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblyRegionSize); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyNumber_Subtract(__pyx_v_assemStart, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_22 = 0;
      __pyx_t_17 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_17, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_6) {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_9 = __pyx_t_7;
      } else {
        __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __pyx_t_9;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_refStart, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "variantcaller.pyx":508
 *             assemEnd = min(assemStart + options.assemblyRegionSize, end)
 *             refStart = max(0, assemStart-options.assemblyRegionSize)
 *             refEnd = assemEnd+options.assemblyRegionSize             # <<<<<<<<<<<<<<
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)
 *             refSequence = refSequenceBytes
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblyRegionSize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyNumber_Add(__pyx_v_assemEnd, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_refEnd, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "variantcaller.pyx":509
 *             refStart = max(0, assemStart-options.assemblyRegionSize)
 *             refEnd = assemEnd+options.assemblyRegionSize
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)             # <<<<<<<<<<<<<<
 *             refSequence = refSequenceBytes
 * 
 */
      __pyx_t_24 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_refStart); if (unlikely((__pyx_t_24 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
      __pyx_t_25 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_refEnd); if (unlikely((__pyx_t_25 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
      __pyx_t_9 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_t_24, __pyx_t_25); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF_SET(__pyx_v_refSequenceBytes, ((PyObject*)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "variantcaller.pyx":510
 *             refEnd = assemEnd+options.assemblyRegionSize
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)
 *             refSequence = refSequenceBytes             # <<<<<<<<<<<<<<
 * 
 *             needToAssemble = doWeNeedToAssembleThisRegion(readBuffers, chrom, assemStart, assemEnd, options, refSequence)
 */
      if (unlikely(__pyx_v_refSequenceBytes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(0, 510, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_refSequenceBytes); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L1_error)
      __pyx_v_refSequence = __pyx_t_2;

      /* "variantcaller.pyx":512
 *             refSequence = refSequenceBytes
 * 
 *             needToAssemble = doWeNeedToAssembleThisRegion(readBuffers, chrom, assemStart, assemEnd, options, refSequence)             # <<<<<<<<<<<<<<
 * 
 *             if not needToAssemble:
 */
      __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_assemStart); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 512, __pyx_L1_error)
      __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_assemEnd); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 512, __pyx_L1_error)
      __pyx_v_needToAssemble = __pyx_f_13variantcaller_doWeNeedToAssembleThisRegion(__pyx_v_readBuffers, __pyx_v_chrom, __pyx_t_3, __pyx_t_20, __pyx_v_options, __pyx_v_refSequence);

      /* "variantcaller.pyx":514
 *             needToAssemble = doWeNeedToAssembleThisRegion(readBuffers, chrom, assemStart, assemEnd, options, refSequence)
 * 
 *             if not needToAssemble:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_6 = ((!(__pyx_v_needToAssemble != 0)) != 0);
      if (__pyx_t_6) {

        /* "variantcaller.pyx":515
 * 
 *             if not needToAssemble:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             #logger.debug("Assembling region %s:%s-%s (ref seq %s:%s-%s)" %(chrom, assemStart, assemEnd, chrom, refStart, refEnd))
 */
        goto __pyx_L19_continue;

        /* "variantcaller.pyx":514
 *             needToAssemble = doWeNeedToAssembleThisRegion(readBuffers, chrom, assemStart, assemEnd, options, refSequence)
 * 
 *             if not needToAssemble:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      }

      /* "variantcaller.pyx":518
 * 
 *             #logger.debug("Assembling region %s:%s-%s (ref seq %s:%s-%s)" %(chrom, assemStart, assemEnd, chrom, refStart, refEnd))
 *             assemblerVariants.extend(assembleReadsAndDetectVariants(chrom, assemStart, assemEnd, refStart, refEnd, readBuffers, refSequence, options))             # <<<<<<<<<<<<<<
 *             #logger.debug("Variants Found by assembler in region are %s" %(assemblerVariants))
 * 
 */
      if (unlikely(__pyx_v_chrom == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(0, 518, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_chrom); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_assemStart); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_assemEnd); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_26 = __Pyx_PyInt_As_int(__pyx_v_refStart); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_v_refEnd); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 518, __pyx_L1_error)
      __pyx_t_9 = __pyx_f_9assembler_assembleReadsAndDetectVariants(__pyx_t_2, __pyx_t_20, __pyx_t_3, __pyx_t_26, __pyx_t_27, __pyx_v_readBuffers, __pyx_v_refSequence, __pyx_v_options); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_21 = __Pyx_PyList_Extend(__pyx_v_assemblerVariants, __pyx_t_9); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "variantcaller.pyx":502
 *         logger.debug("Assembly region windows will be tiled. Each region will start %s bases after the last one" %(assemRegionShift))
 * 
 *         for assemIndex,assemStart in enumerate(xrange(start, end, assemRegionShift)):             # <<<<<<<<<<<<<<
 *         #for assemIndex,assemStart in enumerate(xrange(start, end, options.assemblyRegionSize//2)):
 *         #for assemIndex,assemStart in enumerate(xrange(start, end, options.assemblyRegionSize)):
 */
      __pyx_L19_continue:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "variantcaller.pyx":496
 * 
 *     # Get variants from assembler
 *     if options.assemble:             # <<<<<<<<<<<<<<
 * 
 *         assemRegionShift = max(100, min(1000, options.assemblyRegionSize//2))
 */
  }

  /* "variantcaller.pyx":521
 *             #logger.debug("Variants Found by assembler in region are %s" %(assemblerVariants))
 * 
 *     cdef list allVarCands = rawBamVariants + vcfFileVariants + assemblerVariants             # <<<<<<<<<<<<<<
 *     cdef list leftNormVars = sorted( [leftNormaliseIndel(v, refFile, maxReadLength) for v in allVarCands] )
 *     cdef list filteredVariants = filterVariants(leftNormVars, refFile, maxReadLength, options.minReads, options.maxSize, options.verbosity, options)
 */
  __pyx_t_14 = PyNumber_Add(__pyx_v_rawBamVariants, __pyx_v_vcfFileVariants); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_v_assemblerVariants); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_v_allVarCands = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":522
 * 
 *     cdef list allVarCands = rawBamVariants + vcfFileVariants + assemblerVariants
 *     cdef list leftNormVars = sorted( [leftNormaliseIndel(v, refFile, maxReadLength) for v in allVarCands] )             # <<<<<<<<<<<<<<
 *     cdef list filteredVariants = filterVariants(leftNormVars, refFile, maxReadLength, options.minReads, options.maxSize, options.verbosity, options)
 * 
 */
  __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_9 = __pyx_v_allVarCands; __Pyx_INCREF(__pyx_t_9); __pyx_t_16 = 0;
  for (;;) {
    if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_9)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_7 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_16); __Pyx_INCREF(__pyx_t_7); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 522, __pyx_L1_error)
    #else
    __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_7));
    __pyx_t_7 = 0;
    __pyx_t_7 = ((PyObject *)__pyx_f_13platypusutils_leftNormaliseIndel(__pyx_v_v, __pyx_v_refFile, __pyx_v_maxReadLength)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_5 = ((PyObject*)__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_21 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 522, __pyx_L1_error)
  __pyx_v_leftNormVars = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":523
 *     cdef list allVarCands = rawBamVariants + vcfFileVariants + assemblerVariants
 *     cdef list leftNormVars = sorted( [leftNormaliseIndel(v, refFile, maxReadLength) for v in allVarCands] )
 *     cdef list filteredVariants = filterVariants(leftNormVars, refFile, maxReadLength, options.minReads, options.maxSize, options.verbosity, options)             # <<<<<<<<<<<<<<
 * 
 *     # Need to work out how to consistently report these.
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minReads); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_26 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_f_13variantFilter_filterVariants(__pyx_v_leftNormVars, __pyx_v_refFile, __pyx_v_maxReadLength, __pyx_t_27, __pyx_t_26, __pyx_t_3, __pyx_v_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_filteredVariants = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":526
 * 
 *     # Need to work out how to consistently report these.
 *     logger.debug("There are %s filtered variant candidates in reads which overlap the region %s:%s-%s" %(len(filteredVariants), chrom, start, end))             # <<<<<<<<<<<<<<
 *     return filteredVariants
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (unlikely(__pyx_v_filteredVariants == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 526, __pyx_L1_error)
  }
  __pyx_t_16 = PyList_GET_SIZE(__pyx_v_filteredVariants); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 526, __pyx_L1_error)
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_1);
  __pyx_t_14 = 0;
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_There_are_s_filtered_variant_can, __pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_5 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_17, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":527
 *     # Need to work out how to consistently report these.
 *     logger.debug("There are %s filtered variant candidates in reads which overlap the region %s:%s-%s" %(len(filteredVariants), chrom, start, end))
 *     return filteredVariants             # <<<<<<<<<<<<<<
 * 
 *     cdef list paddedVariants = padVariants(filteredVariants, refFile, chrom)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_filteredVariants);
  __pyx_r = __pyx_v_filteredVariants;
  goto __pyx_L0;

  /* "variantcaller.pyx":412
 * ###################################################################################################
 * 
 * cdef list generateVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Generate a list of variants, based on BAM file data and any input VCFs, in the specified region,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __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_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("variantcaller.generateVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_varCandGen);
  __Pyx_XDECREF((PyObject *)__pyx_v_theReadBuffer);
  __Pyx_XDECREF(__pyx_v_rawBamVariants);
  __Pyx_XDECREF(__pyx_v_vcfFileVariants);
  __Pyx_XDECREF(__pyx_v_assemblerVariants);
  __Pyx_XDECREF(__pyx_v_refSequenceBytes);
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_totalReadsInRegion);
  __Pyx_XDECREF(__pyx_v_totalBufferSizeInRegion);
  __Pyx_XDECREF(__pyx_v_totalSeqQualSize);
  __Pyx_XDECREF((PyObject *)__pyx_v_allSampleVarCandGen);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_variantSource);
  __Pyx_XDECREF(__pyx_v_assemRegionShift);
  __Pyx_XDECREF(__pyx_v_assemIndex);
  __Pyx_XDECREF(__pyx_v_assemStart);
  __Pyx_XDECREF(__pyx_v_assemEnd);
  __Pyx_XDECREF(__pyx_v_refStart);
  __Pyx_XDECREF(__pyx_v_refEnd);
  __Pyx_XDECREF(__pyx_v_allVarCands);
  __Pyx_XDECREF(__pyx_v_leftNormVars);
  __Pyx_XDECREF(__pyx_v_filteredVariants);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":535
 * ###################################################################################################
 * 
 * cdef void callVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list samples, dict samplesByID, dict samplesByBAM, Population pop):             # <<<<<<<<<<<<<<
 *     """
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 */

static void __pyx_f_13variantcaller_callVariantsInRegion(PyObject *__pyx_v_chrom, int __pyx_v_start, int __pyx_v_end, PyObject *__pyx_v_bamFiles, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_options, PyObject *__pyx_v_windowGenerator, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_vcf, PyObject *__pyx_v_samples, PyObject *__pyx_v_samplesByID, PyObject *__pyx_v_samplesByBAM, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop) {
  PY_LONG_LONG __pyx_v_contigLength;
  PY_LONG_LONG __pyx_v_maxContigPos;
  PyObject *__pyx_v_refSequenceBytes = 0;
  char *__pyx_v_refSequence;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_readBuffers = 0;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_readBuffer = 0;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_allSortedVariants = 0;
  PyObject *__pyx_v_windowIndex = NULL;
  PyObject *__pyx_v_windowStart = NULL;
  PyObject *__pyx_v_windowEnd = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_lastPos = NULL;
  PyObject *__pyx_v_lastVars = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_pos = NULL;
  PyObject *__pyx_v_theseVars = NULL;
  PyObject *__pyx_v_lastVarPos = NULL;
  PyObject *__pyx_v_nextVarPos = NULL;
  PyObject *__pyx_v_refBlockStart = NULL;
  PyObject *__pyx_v_refBlockEnd = NULL;
  PyObject *__pyx_v_thisWindow = NULL;
  PyObject *__pyx_v_v = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PY_LONG_LONG __pyx_t_4;
  PY_LONG_LONG __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  char *__pyx_t_8;
  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;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  PyObject *(*__pyx_t_19)(PyObject *);
  Py_ssize_t __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  PyObject *(*__pyx_t_26)(PyObject *);
  __Pyx_RefNannySetupContext("callVariantsInRegion", 0);
  __Pyx_INCREF(__pyx_v_chrom);

  /* "variantcaller.pyx":539
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 *     """
 *     refFile.setCacheSequence(chrom, start-(10*options.rlen), end+(10*options.rlen))             # <<<<<<<<<<<<<<
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_int_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_4 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Multiply(__pyx_int_10, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_3); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->setCacheSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_t_4, __pyx_t_5);

  /* "variantcaller.pyx":541
 *     refFile.setCacheSequence(chrom, start-(10*options.rlen), end+(10*options.rlen))
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength             # <<<<<<<<<<<<<<
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 */
  if (unlikely(__pyx_v_refFile->refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 541, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_refFile->refs, __pyx_v_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SeqLength); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_1); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_contigLength = __pyx_t_5;

  /* "variantcaller.pyx":542
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 *     cdef long long int maxContigPos = contigLength - 1             # <<<<<<<<<<<<<<
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 *     cdef char* refSequence = refSequenceBytes
 */
  __pyx_v_maxContigPos = (__pyx_v_contigLength - 1);

  /* "variantcaller.pyx":543
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))             # <<<<<<<<<<<<<<
 *     cdef char* refSequence = refSequenceBytes
 *     cdef dict window
 */
  if (unlikely(__pyx_v_refFile->refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 543, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_refFile->refs, __pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SeqLength); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyNumber_Multiply(__pyx_int_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_6 = __pyx_t_2;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_6); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_start, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_refSequenceBytes = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "variantcaller.pyx":544
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 *     cdef char* refSequence = refSequenceBytes             # <<<<<<<<<<<<<<
 *     cdef dict window
 *     cdef list readBuffers
 */
  if (unlikely(__pyx_v_refSequenceBytes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 544, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_refSequenceBytes); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 544, __pyx_L1_error)
  __pyx_v_refSequence = __pyx_t_8;

  /* "variantcaller.pyx":549
 *     cdef bamReadBuffer readBuffer
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __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:*/ {

      /* "variantcaller.pyx":550
 * 
 *     try:
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)             # <<<<<<<<<<<<<<
 * 
 *     except Exception, e:
 */
      if (!(likely(PyList_CheckExact(__pyx_v_bamFiles))||((__pyx_v_bamFiles) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_bamFiles)->tp_name), 0))) __PYX_ERR(0, 550, __pyx_L3_error)
      __pyx_t_6 = __pyx_f_13platypusutils_loadBAMData(((PyObject*)__pyx_v_bamFiles), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_options, __pyx_v_samples, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_refSequence); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_readBuffers = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "variantcaller.pyx":549
 *     cdef bamReadBuffer readBuffer
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
    }
    __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_L8_try_end;
    __pyx_L3_error:;
    __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;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "variantcaller.pyx":552
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 *     except Exception, e:             # <<<<<<<<<<<<<<
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 */
    __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_12) {
      __Pyx_AddTraceback("variantcaller.callVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 552, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_e = __pyx_t_1;

      /* "variantcaller.pyx":553
 * 
 *     except Exception, e:
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))             # <<<<<<<<<<<<<<
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 *         return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_logger); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_error); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_15);
      __Pyx_INCREF(__pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_v_e);
      __pyx_t_13 = 0;
      __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyString_Format(__pyx_kp_s_Exception_in_region_s_s_s_Error, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_16)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_3 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_16, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15);
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "variantcaller.pyx":554
 *     except Exception, e:
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_warning); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_16);
      __pyx_t_14 = 0;
      __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_Region_s_s_s_will_be_skipped, __pyx_t_13); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_13, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "variantcaller.pyx":555
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if readBuffers is None:
 */
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "variantcaller.pyx":549
 *     cdef bamReadBuffer readBuffer
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
    __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_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "variantcaller.pyx":557
 *         return
 * 
 *     if readBuffers is None:             # <<<<<<<<<<<<<<
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return
 */
  __pyx_t_7 = (__pyx_v_readBuffers == ((PyObject*)Py_None));
  __pyx_t_17 = (__pyx_t_7 != 0);
  if (__pyx_t_17) {

    /* "variantcaller.pyx":558
 * 
 *     if readBuffers is None:
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_region_s_s_s_as_data_co, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_15, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "variantcaller.pyx":559
 *     if readBuffers is None:
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     cdef list allSortedVariants = generateVariantsInRegion(chrom, start, end, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)
 */
    goto __pyx_L0;

    /* "variantcaller.pyx":557
 *         return
 * 
 *     if readBuffers is None:             # <<<<<<<<<<<<<<
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return
 */
  }

  /* "variantcaller.pyx":561
 *         return
 * 
 *     cdef list allSortedVariants = generateVariantsInRegion(chrom, start, end, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     cdef Variant var,nextVar
 */
  __pyx_t_2 = __pyx_f_13variantcaller_generateVariantsInRegion(__pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_bamFiles, __pyx_v_refFile, __pyx_v_options, __pyx_v_windowGenerator, __pyx_v_outputFile, __pyx_v_vcf, __pyx_v_readBuffers); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_allSortedVariants = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "variantcaller.pyx":566
 *     cdef list sortedVarList
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_2 = __pyx_int_0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_windowGenerator, __pyx_n_s_WindowsAndVariants); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_maxContigPos); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_13 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_13, __pyx_v_chrom, __pyx_t_15, __pyx_t_1, __pyx_t_16, __pyx_v_allSortedVariants, __pyx_v_options};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[7] = {__pyx_t_13, __pyx_v_chrom, __pyx_t_15, __pyx_t_1, __pyx_t_16, __pyx_v_allSortedVariants, __pyx_v_options};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_12, 6+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else
  #endif
  {
    __pyx_t_14 = PyTuple_New(6+__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_12, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_12, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_12, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_12, __pyx_t_16);
    __Pyx_INCREF(__pyx_v_allSortedVariants);
    __Pyx_GIVEREF(__pyx_v_allSortedVariants);
    PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_12, __pyx_v_allSortedVariants);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_12, __pyx_v_options);
    __pyx_t_15 = 0;
    __pyx_t_1 = 0;
    __pyx_t_16 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
    __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_18 = 0;
    __pyx_t_19 = NULL;
  } else {
    __pyx_t_18 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_19 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 566, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  for (;;) {
    if (likely(!__pyx_t_19)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_18 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_18); __Pyx_INCREF(__pyx_t_6); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 566, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_18 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_18); __Pyx_INCREF(__pyx_t_6); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 566, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_19(__pyx_t_3);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 566, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    if (!(likely(PyDict_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_window, ((PyObject*)__pyx_t_6));
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_windowIndex, __pyx_t_2);
    __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "variantcaller.pyx":568
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):
 * 
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             chrom = window['chromosome']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_9);
      /*try:*/ {

        /* "variantcaller.pyx":570
 *         try:
 * 
 *             chrom = window['chromosome']             # <<<<<<<<<<<<<<
 *             windowStart = window['startPos']
 *             windowEnd = window['endPos']
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 570, __pyx_L14_error)
        }
        __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_chromosome); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 570, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 570, __pyx_L14_error)
        __Pyx_DECREF_SET(__pyx_v_chrom, ((PyObject*)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "variantcaller.pyx":571
 * 
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *             windowEnd = window['endPos']
 * 
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 571, __pyx_L14_error)
        }
        __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 571, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_windowStart, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "variantcaller.pyx":572
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']
 *             windowEnd = window['endPos']             # <<<<<<<<<<<<<<
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 572, __pyx_L14_error)
        }
        __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 572, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_XDECREF_SET(__pyx_v_windowEnd, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "variantcaller.pyx":574
 *             windowEnd = window['endPos']
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue
 */
        __pyx_t_6 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_16 = PyObject_RichCompare(__pyx_t_6, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (__pyx_t_7) {
        } else {
          __pyx_t_17 = __pyx_t_7;
          goto __pyx_L23_bool_binop_done;
        }
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 574, __pyx_L14_error)
        }
        __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_20 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 574, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_7 = ((__pyx_t_20 > 0) != 0);
        __pyx_t_17 = __pyx_t_7;
        __pyx_L23_bool_binop_done:;
        if (__pyx_t_17) {

          /* "variantcaller.pyx":575
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_v_chrom);
          __Pyx_GIVEREF(__pyx_v_chrom);
          PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
          __Pyx_INCREF(__pyx_v_windowStart);
          __Pyx_GIVEREF(__pyx_v_windowStart);
          PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_windowStart);
          __Pyx_INCREF(__pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_1);
          __pyx_t_14 = 0;
          __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_very_large_window_s_s_s, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_16 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_15, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1);
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 575, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

          /* "variantcaller.pyx":576
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if len(window['variants']) > 0:
 */
          goto __pyx_L20_try_continue;

          /* "variantcaller.pyx":574
 *             windowEnd = window['endPos']
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue
 */
        }

        /* "variantcaller.pyx":578
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 * 
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 578, __pyx_L14_error)
        }
        __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 578, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_20 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 578, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_17 = ((__pyx_t_20 > 0) != 0);
        if (__pyx_t_17) {

          /* "variantcaller.pyx":579
 * 
 *             if len(window['variants']) > 0:
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)             # <<<<<<<<<<<<<<
 * 
 *             if len(window['variants']) > 0 and len(pop.variantPosteriors.keys()) > 0:
 */
          __pyx_f_13variantcaller_callVariantsInWindow(__pyx_v_window, __pyx_v_options, __pyx_v_refFile, __pyx_v_readBuffers, __pyx_v_pop, __pyx_v_start, __pyx_v_end, __pyx_v_refSequence); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L14_error)

          /* "variantcaller.pyx":578
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 * 
 */
        }

        /* "variantcaller.pyx":581
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 * 
 *             if len(window['variants']) > 0 and len(pop.variantPosteriors.keys()) > 0:             # <<<<<<<<<<<<<<
 *                 outputCallToVCF(pop.varsByPos, pop.vcfInfo, pop.vcfFilter, pop.haplotypes, pop.genotypes, pop.frequencies, pop.genotypeLikelihoods, pop.goodnessOfFitValues, pop.haplotypeIndexes, pop.readBuffers, pop.nIndividuals, vcf, refFile, outputFile, options, pop.variants, window['startPos'], window['endPos'])
 * 
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 581, __pyx_L14_error)
        }
        __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 581, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_20 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 581, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_7 = ((__pyx_t_20 > 0) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_17 = __pyx_t_7;
          goto __pyx_L27_bool_binop_done;
        }
        if (unlikely(__pyx_v_pop->variantPosteriors == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
          __PYX_ERR(0, 581, __pyx_L14_error)
        }
        __pyx_t_16 = __Pyx_PyDict_Keys(__pyx_v_pop->variantPosteriors); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 581, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_20 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 581, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_7 = ((__pyx_t_20 > 0) != 0);
        __pyx_t_17 = __pyx_t_7;
        __pyx_L27_bool_binop_done:;
        if (__pyx_t_17) {

          /* "variantcaller.pyx":582
 * 
 *             if len(window['variants']) > 0 and len(pop.variantPosteriors.keys()) > 0:
 *                 outputCallToVCF(pop.varsByPos, pop.vcfInfo, pop.vcfFilter, pop.haplotypes, pop.genotypes, pop.frequencies, pop.genotypeLikelihoods, pop.goodnessOfFitValues, pop.haplotypeIndexes, pop.readBuffers, pop.nIndividuals, vcf, refFile, outputFile, options, pop.variants, window['startPos'], window['endPos'])             # <<<<<<<<<<<<<<
 * 
 *                 # Need to make ref calls between variants and at start and end of windows
 */
          __pyx_t_16 = __pyx_v_pop->varsByPos;
          __Pyx_INCREF(__pyx_t_16);
          __pyx_t_6 = __pyx_v_pop->vcfInfo;
          __Pyx_INCREF(__pyx_t_6);
          __pyx_t_1 = __pyx_v_pop->vcfFilter;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_15 = __pyx_v_pop->haplotypes;
          __Pyx_INCREF(__pyx_t_15);
          __pyx_t_14 = __pyx_v_pop->genotypes;
          __Pyx_INCREF(__pyx_t_14);
          __pyx_t_13 = __pyx_v_pop->readBuffers;
          __Pyx_INCREF(__pyx_t_13);
          __pyx_t_21 = __pyx_v_pop->variants;
          __Pyx_INCREF(__pyx_t_21);
          if (unlikely(__pyx_v_window == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 582, __pyx_L14_error)
          }
          __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 582, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_22); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 582, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (unlikely(__pyx_v_window == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 582, __pyx_L14_error)
          }
          __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 582, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_22); if (unlikely((__pyx_t_23 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 582, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __pyx_f_8vcfutils_outputCallToVCF(((PyObject*)__pyx_t_16), ((PyObject*)__pyx_t_6), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_15), ((PyObject*)__pyx_t_14), __pyx_v_pop->frequencies, __pyx_v_pop->genotypeLikelihoods, __pyx_v_pop->goodnessOfFitValues, __pyx_v_pop->haplotypeIndexes, ((PyObject*)__pyx_t_13), __pyx_v_pop->nIndividuals, __pyx_v_vcf, __pyx_v_refFile, __pyx_v_outputFile, __pyx_v_options, ((PyObject*)__pyx_t_21), __pyx_t_12, __pyx_t_23);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

          /* "variantcaller.pyx":585
 * 
 *                 # Need to make ref calls between variants and at start and end of windows
 *                 if options.outputRefCalls and len(pop.varsByPos.keys()) > 1:             # <<<<<<<<<<<<<<
 *                     lastPos = None
 *                     lastVars = None
 */
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 585, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 585, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (__pyx_t_7) {
          } else {
            __pyx_t_17 = __pyx_t_7;
            goto __pyx_L30_bool_binop_done;
          }
          if (unlikely(__pyx_v_pop->varsByPos == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
            __PYX_ERR(0, 585, __pyx_L14_error)
          }
          __pyx_t_21 = __Pyx_PyDict_Keys(__pyx_v_pop->varsByPos); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 585, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_20 = PyObject_Length(__pyx_t_21); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 585, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __pyx_t_7 = ((__pyx_t_20 > 1) != 0);
          __pyx_t_17 = __pyx_t_7;
          __pyx_L30_bool_binop_done:;
          if (__pyx_t_17) {

            /* "variantcaller.pyx":586
 *                 # Need to make ref calls between variants and at start and end of windows
 *                 if options.outputRefCalls and len(pop.varsByPos.keys()) > 1:
 *                     lastPos = None             # <<<<<<<<<<<<<<
 *                     lastVars = None
 * 
 */
            __Pyx_INCREF(Py_None);
            __Pyx_XDECREF_SET(__pyx_v_lastPos, Py_None);

            /* "variantcaller.pyx":587
 *                 if options.outputRefCalls and len(pop.varsByPos.keys()) > 1:
 *                     lastPos = None
 *                     lastVars = None             # <<<<<<<<<<<<<<
 * 
 *                     for index,(pos,theseVars) in enumerate(pop.varsByPos.iteritems()):
 */
            __Pyx_INCREF(Py_None);
            __Pyx_XDECREF_SET(__pyx_v_lastVars, Py_None);

            /* "variantcaller.pyx":589
 *                     lastVars = None
 * 
 *                     for index,(pos,theseVars) in enumerate(pop.varsByPos.iteritems()):             # <<<<<<<<<<<<<<
 *                         if index > 0:
 *                             lastVarPos = max([v.maxRefPos for v in lastVars])
 */
            __Pyx_INCREF(__pyx_int_0);
            __pyx_t_21 = __pyx_int_0;
            __pyx_t_20 = 0;
            if (unlikely(__pyx_v_pop->varsByPos == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
              __PYX_ERR(0, 589, __pyx_L14_error)
            }
            __pyx_t_14 = __Pyx_dict_iterator(__pyx_v_pop->varsByPos, 1, __pyx_n_s_iteritems, (&__pyx_t_24), (&__pyx_t_23)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 589, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_XDECREF(__pyx_t_13);
            __pyx_t_13 = __pyx_t_14;
            __pyx_t_14 = 0;
            while (1) {
              __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_13, __pyx_t_24, &__pyx_t_20, &__pyx_t_14, &__pyx_t_15, NULL, __pyx_t_23);
              if (unlikely(__pyx_t_12 == 0)) break;
              if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 589, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_14);
              __pyx_t_14 = 0;
              __Pyx_XDECREF_SET(__pyx_v_theseVars, __pyx_t_15);
              __pyx_t_15 = 0;
              __Pyx_INCREF(__pyx_t_21);
              __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_21);
              __pyx_t_15 = __Pyx_PyInt_AddObjC(__pyx_t_21, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 589, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_21);
              __pyx_t_21 = __pyx_t_15;
              __pyx_t_15 = 0;

              /* "variantcaller.pyx":590
 * 
 *                     for index,(pos,theseVars) in enumerate(pop.varsByPos.iteritems()):
 *                         if index > 0:             # <<<<<<<<<<<<<<
 *                             lastVarPos = max([v.maxRefPos for v in lastVars])
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing
 */
              __pyx_t_15 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 590, __pyx_L14_error)
              __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 590, __pyx_L14_error)
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
              if (__pyx_t_17) {

                /* "variantcaller.pyx":591
 *                     for index,(pos,theseVars) in enumerate(pop.varsByPos.iteritems()):
 *                         if index > 0:
 *                             lastVarPos = max([v.maxRefPos for v in lastVars])             # <<<<<<<<<<<<<<
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing
 * 
 */
                __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 591, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_15);
                if (likely(PyList_CheckExact(__pyx_v_lastVars)) || PyTuple_CheckExact(__pyx_v_lastVars)) {
                  __pyx_t_14 = __pyx_v_lastVars; __Pyx_INCREF(__pyx_t_14); __pyx_t_25 = 0;
                  __pyx_t_26 = NULL;
                } else {
                  __pyx_t_25 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_lastVars); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 591, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_26 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 591, __pyx_L14_error)
                }
                for (;;) {
                  if (likely(!__pyx_t_26)) {
                    if (likely(PyList_CheckExact(__pyx_t_14))) {
                      if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_14)) break;
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 591, __pyx_L14_error)
                      #else
                      __pyx_t_1 = PySequence_ITEM(__pyx_t_14, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_1);
                      #endif
                    } else {
                      if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 591, __pyx_L14_error)
                      #else
                      __pyx_t_1 = PySequence_ITEM(__pyx_t_14, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_1);
                      #endif
                    }
                  } else {
                    __pyx_t_1 = __pyx_t_26(__pyx_t_14);
                    if (unlikely(!__pyx_t_1)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                        else __PYX_ERR(0, 591, __pyx_L14_error)
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_1);
                  }
                  __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
                  __pyx_t_1 = 0;
                  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_maxRefPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 591, __pyx_L14_error)
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                }
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 591, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_XDECREF_SET(__pyx_v_lastVarPos, __pyx_t_14);
                __pyx_t_14 = 0;

                /* "variantcaller.pyx":592
 *                         if index > 0:
 *                             lastVarPos = max([v.maxRefPos for v in lastVars])
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing             # <<<<<<<<<<<<<<
 * 
 *                             if nextVarPos - lastVarPos > 1:
 */
                __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 592, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_14);
                if (likely(PyList_CheckExact(__pyx_v_theseVars)) || PyTuple_CheckExact(__pyx_v_theseVars)) {
                  __pyx_t_15 = __pyx_v_theseVars; __Pyx_INCREF(__pyx_t_15); __pyx_t_25 = 0;
                  __pyx_t_26 = NULL;
                } else {
                  __pyx_t_25 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_v_theseVars); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_26 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 592, __pyx_L14_error)
                }
                for (;;) {
                  if (likely(!__pyx_t_26)) {
                    if (likely(PyList_CheckExact(__pyx_t_15))) {
                      if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_15)) break;
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L14_error)
                      #else
                      __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_1);
                      #endif
                    } else {
                      if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_25); __Pyx_INCREF(__pyx_t_1); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L14_error)
                      #else
                      __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_1);
                      #endif
                    }
                  } else {
                    __pyx_t_1 = __pyx_t_26(__pyx_t_15);
                    if (unlikely(!__pyx_t_1)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                        else __PYX_ERR(0, 592, __pyx_L14_error)
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_1);
                  }
                  __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
                  __pyx_t_1 = 0;
                  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_minRefPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 592, __pyx_L14_error)
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                }
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 592, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_15);
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_14 = __Pyx_PyInt_AddObjC(__pyx_t_15, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 592, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                __Pyx_XDECREF_SET(__pyx_v_nextVarPos, __pyx_t_14);
                __pyx_t_14 = 0;

                /* "variantcaller.pyx":594
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing
 * 
 *                             if nextVarPos - lastVarPos > 1:             # <<<<<<<<<<<<<<
 *                                 for refBlockStart in xrange(lastVarPos+1, nextVarPos, options.refCallBlockSize):
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 */
                __pyx_t_14 = PyNumber_Subtract(__pyx_v_nextVarPos, __pyx_v_lastVarPos); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 594, __pyx_L14_error)
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_15 = PyObject_RichCompare(__pyx_t_14, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 594, __pyx_L14_error)
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 594, __pyx_L14_error)
                __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                if (__pyx_t_17) {

                  /* "variantcaller.pyx":595
 * 
 *                             if nextVarPos - lastVarPos > 1:
 *                                 for refBlockStart in xrange(lastVarPos+1, nextVarPos, options.refCallBlockSize):             # <<<<<<<<<<<<<<
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 * 
 */
                  __pyx_t_15 = __Pyx_PyInt_AddObjC(__pyx_v_lastVarPos, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 595, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_15);
                  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refCallBlockSize); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 595, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_1);
                  __Pyx_GIVEREF(__pyx_t_15);
                  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15);
                  __Pyx_INCREF(__pyx_v_nextVarPos);
                  __Pyx_GIVEREF(__pyx_v_nextVarPos);
                  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_nextVarPos);
                  __Pyx_GIVEREF(__pyx_t_14);
                  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_14);
                  __pyx_t_15 = 0;
                  __pyx_t_14 = 0;
                  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_1, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 595, __pyx_L14_error)
                  __Pyx_GOTREF(__pyx_t_14);
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                  if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) {
                    __pyx_t_1 = __pyx_t_14; __Pyx_INCREF(__pyx_t_1); __pyx_t_25 = 0;
                    __pyx_t_26 = NULL;
                  } else {
                    __pyx_t_25 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_1);
                    __pyx_t_26 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 595, __pyx_L14_error)
                  }
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  for (;;) {
                    if (likely(!__pyx_t_26)) {
                      if (likely(PyList_CheckExact(__pyx_t_1))) {
                        if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_1)) break;
                        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                        __pyx_t_14 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_25); __Pyx_INCREF(__pyx_t_14); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L14_error)
                        #else
                        __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 595, __pyx_L14_error)
                        __Pyx_GOTREF(__pyx_t_14);
                        #endif
                      } else {
                        if (__pyx_t_25 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
                        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                        __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_25); __Pyx_INCREF(__pyx_t_14); __pyx_t_25++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L14_error)
                        #else
                        __pyx_t_14 = PySequence_ITEM(__pyx_t_1, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 595, __pyx_L14_error)
                        __Pyx_GOTREF(__pyx_t_14);
                        #endif
                      }
                    } else {
                      __pyx_t_14 = __pyx_t_26(__pyx_t_1);
                      if (unlikely(!__pyx_t_14)) {
                        PyObject* exc_type = PyErr_Occurred();
                        if (exc_type) {
                          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                          else __PYX_ERR(0, 595, __pyx_L14_error)
                        }
                        break;
                      }
                      __Pyx_GOTREF(__pyx_t_14);
                    }
                    __Pyx_XDECREF_SET(__pyx_v_refBlockStart, __pyx_t_14);
                    __pyx_t_14 = 0;

                    /* "variantcaller.pyx":596
 *                             if nextVarPos - lastVarPos > 1:
 *                                 for refBlockStart in xrange(lastVarPos+1, nextVarPos, options.refCallBlockSize):
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)             # <<<<<<<<<<<<<<
 * 
 *                                     if refBlockStart == refBlockEnd:
 */
                    __pyx_t_14 = __Pyx_PyInt_SubtractObjC(__pyx_v_nextVarPos, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 596, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_14);
                    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refCallBlockSize); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 596, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_15);
                    __pyx_t_6 = PyNumber_Add(__pyx_v_refBlockStart, __pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_6);
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                    __pyx_t_16 = PyObject_RichCompare(__pyx_t_14, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 596, __pyx_L14_error)
                    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 596, __pyx_L14_error)
                    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                    if (__pyx_t_17) {
                      __Pyx_INCREF(__pyx_t_14);
                      __pyx_t_15 = __pyx_t_14;
                    } else {
                      __Pyx_INCREF(__pyx_t_6);
                      __pyx_t_15 = __pyx_t_6;
                    }
                    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __pyx_t_14 = __pyx_t_15;
                    __Pyx_INCREF(__pyx_t_14);
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                    __Pyx_XDECREF_SET(__pyx_v_refBlockEnd, __pyx_t_14);
                    __pyx_t_14 = 0;

                    /* "variantcaller.pyx":598
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 * 
 *                                     if refBlockStart == refBlockEnd:             # <<<<<<<<<<<<<<
 *                                         continue
 * 
 */
                    __pyx_t_14 = PyObject_RichCompare(__pyx_v_refBlockStart, __pyx_v_refBlockEnd, Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 598, __pyx_L14_error)
                    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 598, __pyx_L14_error)
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    if (__pyx_t_17) {

                      /* "variantcaller.pyx":599
 * 
 *                                     if refBlockStart == refBlockEnd:
 *                                         continue             # <<<<<<<<<<<<<<
 * 
 *                                     thisWindow = dict(chromosome=chrom,startPos=refBlockStart, endPos=refBlockEnd,variants=[],nVar=0)
 */
                      goto __pyx_L40_continue;

                      /* "variantcaller.pyx":598
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 * 
 *                                     if refBlockStart == refBlockEnd:             # <<<<<<<<<<<<<<
 *                                         continue
 * 
 */
                    }

                    /* "variantcaller.pyx":601
 *                                         continue
 * 
 *                                     thisWindow = dict(chromosome=chrom,startPos=refBlockStart, endPos=refBlockEnd,variants=[],nVar=0)             # <<<<<<<<<<<<<<
 *                                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, thisWindow, options, readBuffers)
 *                         lastPos = pos
 */
                    __pyx_t_14 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 601, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_14);
                    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_chromosome, __pyx_v_chrom) < 0) __PYX_ERR(0, 601, __pyx_L14_error)
                    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_startPos, __pyx_v_refBlockStart) < 0) __PYX_ERR(0, 601, __pyx_L14_error)
                    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_endPos, __pyx_v_refBlockEnd) < 0) __PYX_ERR(0, 601, __pyx_L14_error)
                    __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 601, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_15);
                    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_variants, __pyx_t_15) < 0) __PYX_ERR(0, 601, __pyx_L14_error)
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_nVar, __pyx_int_0) < 0) __PYX_ERR(0, 601, __pyx_L14_error)
                    __Pyx_XDECREF_SET(__pyx_v_thisWindow, ((PyObject*)__pyx_t_14));
                    __pyx_t_14 = 0;

                    /* "variantcaller.pyx":602
 * 
 *                                     thisWindow = dict(chromosome=chrom,startPos=refBlockStart, endPos=refBlockEnd,variants=[],nVar=0)
 *                                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, thisWindow, options, readBuffers)             # <<<<<<<<<<<<<<
 *                         lastPos = pos
 *                         lastVars = theseVars
 */
                    __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_outputRefCall); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 602, __pyx_L14_error)
                    __Pyx_GOTREF(__pyx_t_15);
                    __pyx_t_6 = NULL;
                    __pyx_t_12 = 0;
                    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
                      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_15);
                      if (likely(__pyx_t_6)) {
                        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
                        __Pyx_INCREF(__pyx_t_6);
                        __Pyx_INCREF(function);
                        __Pyx_DECREF_SET(__pyx_t_15, function);
                        __pyx_t_12 = 1;
                      }
                    }
                    #if CYTHON_FAST_PYCALL
                    if (PyFunction_Check(__pyx_t_15)) {
                      PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_v_chrom, ((PyObject *)__pyx_v_pop), __pyx_v_vcf, ((PyObject *)__pyx_v_refFile), __pyx_v_outputFile, __pyx_v_windowIndex, __pyx_v_thisWindow, __pyx_v_options, __pyx_v_readBuffers};
                      __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 602, __pyx_L14_error)
                      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
                      __Pyx_GOTREF(__pyx_t_14);
                    } else
                    #endif
                    #if CYTHON_FAST_PYCCALL
                    if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
                      PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_v_chrom, ((PyObject *)__pyx_v_pop), __pyx_v_vcf, ((PyObject *)__pyx_v_refFile), __pyx_v_outputFile, __pyx_v_windowIndex, __pyx_v_thisWindow, __pyx_v_options, __pyx_v_readBuffers};
                      __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 602, __pyx_L14_error)
                      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
                      __Pyx_GOTREF(__pyx_t_14);
                    } else
                    #endif
                    {
                      __pyx_t_16 = PyTuple_New(9+__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 602, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_16);
                      if (__pyx_t_6) {
                        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6); __pyx_t_6 = NULL;
                      }
                      __Pyx_INCREF(__pyx_v_chrom);
                      __Pyx_GIVEREF(__pyx_v_chrom);
                      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_12, __pyx_v_chrom);
                      __Pyx_INCREF(((PyObject *)__pyx_v_pop));
                      __Pyx_GIVEREF(((PyObject *)__pyx_v_pop));
                      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_12, ((PyObject *)__pyx_v_pop));
                      __Pyx_INCREF(__pyx_v_vcf);
                      __Pyx_GIVEREF(__pyx_v_vcf);
                      PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_12, __pyx_v_vcf);
                      __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
                      __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
                      PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_12, ((PyObject *)__pyx_v_refFile));
                      __Pyx_INCREF(__pyx_v_outputFile);
                      __Pyx_GIVEREF(__pyx_v_outputFile);
                      PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_12, __pyx_v_outputFile);
                      __Pyx_INCREF(__pyx_v_windowIndex);
                      __Pyx_GIVEREF(__pyx_v_windowIndex);
                      PyTuple_SET_ITEM(__pyx_t_16, 5+__pyx_t_12, __pyx_v_windowIndex);
                      __Pyx_INCREF(__pyx_v_thisWindow);
                      __Pyx_GIVEREF(__pyx_v_thisWindow);
                      PyTuple_SET_ITEM(__pyx_t_16, 6+__pyx_t_12, __pyx_v_thisWindow);
                      __Pyx_INCREF(__pyx_v_options);
                      __Pyx_GIVEREF(__pyx_v_options);
                      PyTuple_SET_ITEM(__pyx_t_16, 7+__pyx_t_12, __pyx_v_options);
                      __Pyx_INCREF(__pyx_v_readBuffers);
                      __Pyx_GIVEREF(__pyx_v_readBuffers);
                      PyTuple_SET_ITEM(__pyx_t_16, 8+__pyx_t_12, __pyx_v_readBuffers);
                      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 602, __pyx_L14_error)
                      __Pyx_GOTREF(__pyx_t_14);
                      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                    }
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

                    /* "variantcaller.pyx":595
 * 
 *                             if nextVarPos - lastVarPos > 1:
 *                                 for refBlockStart in xrange(lastVarPos+1, nextVarPos, options.refCallBlockSize):             # <<<<<<<<<<<<<<
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 * 
 */
                    __pyx_L40_continue:;
                  }
                  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

                  /* "variantcaller.pyx":594
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing
 * 
 *                             if nextVarPos - lastVarPos > 1:             # <<<<<<<<<<<<<<
 *                                 for refBlockStart in xrange(lastVarPos+1, nextVarPos, options.refCallBlockSize):
 *                                     refBlockEnd = min(refBlockStart + options.refCallBlockSize, nextVarPos-1)
 */
                }

                /* "variantcaller.pyx":590
 * 
 *                     for index,(pos,theseVars) in enumerate(pop.varsByPos.iteritems()):
 *                         if index > 0:             # <<<<<<<<<<<<<<
 *                             lastVarPos = max([v.maxRefPos for v in lastVars])
 *                             nextVarPos = min([v.minRefPos for v in theseVars]) + 1 # To account for VCF 1-indexing vs Variant 0-indexing
 */
              }

              /* "variantcaller.pyx":603
 *                                     thisWindow = dict(chromosome=chrom,startPos=refBlockStart, endPos=refBlockEnd,variants=[],nVar=0)
 *                                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, thisWindow, options, readBuffers)
 *                         lastPos = pos             # <<<<<<<<<<<<<<
 *                         lastVars = theseVars
 *             else:
 */
              __Pyx_INCREF(__pyx_v_pos);
              __Pyx_DECREF_SET(__pyx_v_lastPos, __pyx_v_pos);

              /* "variantcaller.pyx":604
 *                                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, thisWindow, options, readBuffers)
 *                         lastPos = pos
 *                         lastVars = theseVars             # <<<<<<<<<<<<<<
 *             else:
 *                 if options.outputRefCalls:
 */
              __Pyx_INCREF(__pyx_v_theseVars);
              __Pyx_DECREF_SET(__pyx_v_lastVars, __pyx_v_theseVars);
            }
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

            /* "variantcaller.pyx":585
 * 
 *                 # Need to make ref calls between variants and at start and end of windows
 *                 if options.outputRefCalls and len(pop.varsByPos.keys()) > 1:             # <<<<<<<<<<<<<<
 *                     lastPos = None
 *                     lastVars = None
 */
          }

          /* "variantcaller.pyx":581
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 * 
 *             if len(window['variants']) > 0 and len(pop.variantPosteriors.keys()) > 0:             # <<<<<<<<<<<<<<
 *                 outputCallToVCF(pop.varsByPos, pop.vcfInfo, pop.vcfFilter, pop.haplotypes, pop.genotypes, pop.frequencies, pop.genotypeLikelihoods, pop.goodnessOfFitValues, pop.haplotypeIndexes, pop.readBuffers, pop.nIndividuals, vcf, refFile, outputFile, options, pop.variants, window['startPos'], window['endPos'])
 * 
 */
          goto __pyx_L26;
        }

        /* "variantcaller.pyx":606
 *                         lastVars = theseVars
 *             else:
 *                 if options.outputRefCalls:             # <<<<<<<<<<<<<<
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)
 * 
 */
        /*else*/ {
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 606, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 606, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (__pyx_t_17) {

            /* "variantcaller.pyx":607
 *             else:
 *                 if options.outputRefCalls:
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *             if options.compressReads:
 */
            __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_outputRefCall); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 607, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_1 = NULL;
            __pyx_t_23 = 0;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_13);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_13, function);
                __pyx_t_23 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_13)) {
              PyObject *__pyx_temp[10] = {__pyx_t_1, __pyx_v_chrom, ((PyObject *)__pyx_v_pop), __pyx_v_vcf, ((PyObject *)__pyx_v_refFile), __pyx_v_outputFile, __pyx_v_windowIndex, __pyx_v_window, __pyx_v_options, __pyx_v_readBuffers};
              __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_23, 9+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 607, __pyx_L14_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_21);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
              PyObject *__pyx_temp[10] = {__pyx_t_1, __pyx_v_chrom, ((PyObject *)__pyx_v_pop), __pyx_v_vcf, ((PyObject *)__pyx_v_refFile), __pyx_v_outputFile, __pyx_v_windowIndex, __pyx_v_window, __pyx_v_options, __pyx_v_readBuffers};
              __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_23, 9+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 607, __pyx_L14_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_21);
            } else
            #endif
            {
              __pyx_t_14 = PyTuple_New(9+__pyx_t_23); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 607, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_14);
              if (__pyx_t_1) {
                __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1); __pyx_t_1 = NULL;
              }
              __Pyx_INCREF(__pyx_v_chrom);
              __Pyx_GIVEREF(__pyx_v_chrom);
              PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_23, __pyx_v_chrom);
              __Pyx_INCREF(((PyObject *)__pyx_v_pop));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_pop));
              PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_23, ((PyObject *)__pyx_v_pop));
              __Pyx_INCREF(__pyx_v_vcf);
              __Pyx_GIVEREF(__pyx_v_vcf);
              PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_23, __pyx_v_vcf);
              __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
              __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
              PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_23, ((PyObject *)__pyx_v_refFile));
              __Pyx_INCREF(__pyx_v_outputFile);
              __Pyx_GIVEREF(__pyx_v_outputFile);
              PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_23, __pyx_v_outputFile);
              __Pyx_INCREF(__pyx_v_windowIndex);
              __Pyx_GIVEREF(__pyx_v_windowIndex);
              PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_23, __pyx_v_windowIndex);
              __Pyx_INCREF(__pyx_v_window);
              __Pyx_GIVEREF(__pyx_v_window);
              PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_23, __pyx_v_window);
              __Pyx_INCREF(__pyx_v_options);
              __Pyx_GIVEREF(__pyx_v_options);
              PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_23, __pyx_v_options);
              __Pyx_INCREF(__pyx_v_readBuffers);
              __Pyx_GIVEREF(__pyx_v_readBuffers);
              PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_23, __pyx_v_readBuffers);
              __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_14, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 607, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_21);
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            }
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

            /* "variantcaller.pyx":606
 *                         lastVars = theseVars
 *             else:
 *                 if options.outputRefCalls:             # <<<<<<<<<<<<<<
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)
 * 
 */
          }
        }
        __pyx_L26:;

        /* "variantcaller.pyx":609
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)
 * 
 *             if options.compressReads:             # <<<<<<<<<<<<<<
 *                 for readBuffer in readBuffers:
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 */
        __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_compressReads); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 609, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 609, __pyx_L14_error)
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        if (__pyx_t_17) {

          /* "variantcaller.pyx":610
 * 
 *             if options.compressReads:
 *                 for readBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 * 
 */
          if (unlikely(__pyx_v_readBuffers == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 610, __pyx_L14_error)
          }
          __pyx_t_21 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_21); __pyx_t_24 = 0;
          for (;;) {
            if (__pyx_t_24 >= PyList_GET_SIZE(__pyx_t_21)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_13 = PyList_GET_ITEM(__pyx_t_21, __pyx_t_24); __Pyx_INCREF(__pyx_t_13); __pyx_t_24++; if (unlikely(0 < 0)) __PYX_ERR(0, 610, __pyx_L14_error)
            #else
            __pyx_t_13 = PySequence_ITEM(__pyx_t_21, __pyx_t_24); __pyx_t_24++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 610, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_13);
            #endif
            if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 610, __pyx_L14_error)
            __Pyx_XDECREF_SET(__pyx_v_readBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_13));
            __pyx_t_13 = 0;

            /* "variantcaller.pyx":611
 *             if options.compressReads:
 *                 for readBuffer in readBuffers:
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)             # <<<<<<<<<<<<<<
 * 
 *         except Exception, e:
 */
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qualBinSize); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 611, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_13); if (unlikely((__pyx_t_23 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 611, __pyx_L14_error)
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_compressReads); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 611, __pyx_L14_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_13); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 611, __pyx_L14_error)
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_readBuffer->__pyx_vtab)->recompressReadsInCurrentWindow(__pyx_v_readBuffer, __pyx_v_start, __pyx_v_end, __pyx_v_refSequence, __pyx_t_23, __pyx_t_12);

            /* "variantcaller.pyx":610
 * 
 *             if options.compressReads:
 *                 for readBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 * 
 */
          }
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;

          /* "variantcaller.pyx":609
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)
 * 
 *             if options.compressReads:             # <<<<<<<<<<<<<<
 *                 for readBuffer in readBuffers:
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 */
        }

        /* "variantcaller.pyx":568
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):
 * 
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             chrom = window['chromosome']
 */
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L21_try_end;
      __pyx_L14_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "variantcaller.pyx":613
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 * 
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))
 */
      __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_12) {
        __Pyx_AddTraceback("variantcaller.callVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_13, &__pyx_t_14) < 0) __PYX_ERR(0, 613, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_21);
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_13);

        /* "variantcaller.pyx":614
 * 
 *         except Exception, e:
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))             # <<<<<<<<<<<<<<
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_logger); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_exception); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 614, __pyx_L16_except_error)
        }
        __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 614, __pyx_L16_except_error)
        }
        __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_v_e);
        __pyx_t_15 = 0;
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Exception_in_window_d_d_Error_wa, __pyx_t_22); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_t_22 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_22)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_22);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
          }
        }
        __pyx_t_1 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_22, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_6);
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "variantcaller.pyx":615
 *         except Exception, e:
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_logger); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_warning); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 615, __pyx_L16_except_error)
        }
        __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 615, __pyx_L16_except_error)
        }
        __pyx_t_22 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_v_chrom);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_22);
        PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_22);
        __pyx_t_16 = 0;
        __pyx_t_22 = 0;
        __pyx_t_22 = __Pyx_PyString_Format(__pyx_kp_s_Window_s_s_s_will_be_skipped, __pyx_t_15); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_15, __pyx_t_22) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_22);
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L16_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L15_exception_handled;
      }
      goto __pyx_L16_except_error;
      __pyx_L16_except_error:;

      /* "variantcaller.pyx":568
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):
 * 
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             chrom = window['chromosome']
 */
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L1_error;
      __pyx_L20_try_continue:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      goto __pyx_L12_continue;
      __pyx_L15_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      __pyx_L21_try_end:;
    }

    /* "variantcaller.pyx":566
 *     cdef list sortedVarList
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_L12_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":535
 * ###################################################################################################
 * 
 * cdef void callVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list samples, dict samplesByID, dict samplesByBAM, Population pop):             # <<<<<<<<<<<<<<
 *     """
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 */

  /* function exit code */
  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_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_WriteUnraisable("variantcaller.callVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_refSequenceBytes);
  __Pyx_XDECREF(__pyx_v_window);
  __Pyx_XDECREF(__pyx_v_readBuffers);
  __Pyx_XDECREF((PyObject *)__pyx_v_readBuffer);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_allSortedVariants);
  __Pyx_XDECREF(__pyx_v_windowIndex);
  __Pyx_XDECREF(__pyx_v_windowStart);
  __Pyx_XDECREF(__pyx_v_windowEnd);
  __Pyx_XDECREF(__pyx_v_lastPos);
  __Pyx_XDECREF(__pyx_v_lastVars);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_theseVars);
  __Pyx_XDECREF(__pyx_v_lastVarPos);
  __Pyx_XDECREF(__pyx_v_nextVarPos);
  __Pyx_XDECREF(__pyx_v_refBlockStart);
  __Pyx_XDECREF(__pyx_v_refBlockEnd);
  __Pyx_XDECREF(__pyx_v_thisWindow);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_RefNannyFinishContext();
}

/* "variantcaller.pyx":619
 * ###################################################################################################
 * ###################################################################################################
 * cdef void callHLAVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list samples, dict samplesByID, dict samplesByBAM, Population pop):             # <<<<<<<<<<<<<<
 *     """
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 */

static void __pyx_f_13variantcaller_callHLAVariantsInRegion(PyObject *__pyx_v_chrom, int __pyx_v_start, int __pyx_v_end, PyObject *__pyx_v_bamFiles, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_options, PyObject *__pyx_v_windowGenerator, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_vcf, PyObject *__pyx_v_samples, PyObject *__pyx_v_samplesByID, PyObject *__pyx_v_samplesByBAM, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop) {
  PY_LONG_LONG __pyx_v_contigLength;
  PY_LONG_LONG __pyx_v_maxContigPos;
  PyObject *__pyx_v_refSequenceBytes = 0;
  char *__pyx_v_refSequence;
  PyObject *__pyx_v_window = 0;
  PyObject *__pyx_v_readBuffers = 0;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_readBuffer = 0;
  PyObject *__pyx_v_variantSource = 0;
  PyObject *__pyx_v_tempSource = 0;
  struct __pyx_obj_7variant_Variant *__pyx_v_var = 0;
  struct __pyx_obj_7variant_Variant *__pyx_v_thisVar = 0;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_allAssemblyVariants = 0;
  PyObject *__pyx_v_filteredAssemblyVariants = 0;
  PyObject *__pyx_v_longVarList = 0;
  CYTHON_UNUSED PyObject *__pyx_v_windowHapList = 0;
  PyObject *__pyx_v_windowLongVars = 0;
  int __pyx_v_nWindow;
  CYTHON_UNUSED PyObject *__pyx_v_windowIndex = NULL;
  PyObject *__pyx_v_windowStart = NULL;
  PyObject *__pyx_v_windowEnd = NULL;
  PyObject *__pyx_v_allVarSourceHaplotypes = 0;
  PyObject *__pyx_v_allAssemblerHaplotypes = 0;
  PyObject *__pyx_v_allHaplotypes = 0;
  PyObject *__pyx_v_allUniqueHaplotypes = 0;
  CYTHON_UNUSED PyObject *__pyx_v_allGenotypes = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_refHaplotype = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap = 0;
  CYTHON_UNUSED int __pyx_v_maxEMIterations;
  CYTHON_UNUSED int __pyx_v_nUniqueHaplotypes;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_format = NULL;
  PyObject *__pyx_v_infoLine = NULL;
  PyObject *__pyx_v_theLine = NULL;
  Py_ssize_t __pyx_v_i;
  ptrdiff_t __pyx_v_nReads;
  PyObject *__pyx_v_sampleLine = NULL;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_tempReads;
  CYTHON_UNUSED __pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead;
  __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;
  PY_LONG_LONG __pyx_t_6;
  PY_LONG_LONG __pyx_t_7;
  int __pyx_t_8;
  char *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  int __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_t_21;
  PyObject *(*__pyx_t_22)(PyObject *);
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_t_25;
  __Pyx_RefNannySetupContext("callHLAVariantsInRegion", 0);
  __Pyx_INCREF(__pyx_v_chrom);

  /* "variantcaller.pyx":623
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 *     """
 *     logger.info('start - end of region %d - %d' %(start, end))             # <<<<<<<<<<<<<<
 *     refFile.setCacheSequence(chrom, start-(10*options.rlen), end+(10*options.rlen))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_start_end_of_region_d_d, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":624
 *     """
 *     logger.info('start - end of region %d - %d' %(start, end))
 *     refFile.setCacheSequence(chrom, start-(10*options.rlen), end+(10*options.rlen))             # <<<<<<<<<<<<<<
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Multiply(__pyx_int_10, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __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_PyInt_As_PY_LONG_LONG(__pyx_t_3); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Multiply(__pyx_int_10, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __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_7 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_4); if (unlikely((__pyx_t_7 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->setCacheSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_t_6, __pyx_t_7);

  /* "variantcaller.pyx":626
 *     refFile.setCacheSequence(chrom, start-(10*options.rlen), end+(10*options.rlen))
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength             # <<<<<<<<<<<<<<
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 */
  if (unlikely(__pyx_v_refFile->refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 626, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_refFile->refs, __pyx_v_chrom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_SeqLength); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_1); if (unlikely((__pyx_t_7 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_contigLength = __pyx_t_7;

  /* "variantcaller.pyx":627
 * 
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 *     cdef long long int maxContigPos = contigLength - 1             # <<<<<<<<<<<<<<
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 *     cdef char* refSequence = refSequenceBytes
 */
  __pyx_v_maxContigPos = (__pyx_v_contigLength - 1);

  /* "variantcaller.pyx":628
 *     cdef long long int contigLength = refFile.refs[chrom].SeqLength
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))             # <<<<<<<<<<<<<<
 *     cdef char* refSequence = refSequenceBytes
 *     cdef dict window
 */
  if (unlikely(__pyx_v_refFile->refs == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 628, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_refFile->refs, __pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SeqLength); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_Multiply(__pyx_int_5, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __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_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_5); if (unlikely((__pyx_t_7 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_start, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_refSequenceBytes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":629
 *     cdef long long int maxContigPos = contigLength - 1
 *     cdef bytes refSequenceBytes = refFile.getSequence(chrom,start, min(end+5*options.rlen, refFile.refs[chrom].SeqLength-1))
 *     cdef char* refSequence = refSequenceBytes             # <<<<<<<<<<<<<<
 *     cdef dict window
 *     cdef list readBuffers
 */
  if (unlikely(__pyx_v_refSequenceBytes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 629, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsWritableString(__pyx_v_refSequenceBytes); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 629, __pyx_L1_error)
  __pyx_v_refSequence = __pyx_t_9;

  /* "variantcaller.pyx":633
 *     cdef list readBuffers
 *     cdef bamReadBuffer readBuffer
 *     cdef list variantSource = None             # <<<<<<<<<<<<<<
 *     cdef list tempSource
 *     cdef Variant var, thisVar, nexVar
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_variantSource = ((PyObject*)Py_None);

  /* "variantcaller.pyx":637
 *     cdef Variant var, thisVar, nexVar
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "variantcaller.pyx":638
 * 
 *     try:
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)             # <<<<<<<<<<<<<<
 * 
 *     except Exception, e:
 */
      if (!(likely(PyList_CheckExact(__pyx_v_bamFiles))||((__pyx_v_bamFiles) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_bamFiles)->tp_name), 0))) __PYX_ERR(0, 638, __pyx_L3_error)
      __pyx_t_5 = __pyx_f_13platypusutils_loadBAMData(((PyObject*)__pyx_v_bamFiles), __pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_options, __pyx_v_samples, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_refSequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_readBuffers = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "variantcaller.pyx":637
 *     cdef Variant var, thisVar, nexVar
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __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;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "variantcaller.pyx":640
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 *     except Exception, e:             # <<<<<<<<<<<<<<
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 */
    __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_13) {
      __Pyx_AddTraceback("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 640, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_e = __pyx_t_1;

      /* "variantcaller.pyx":641
 * 
 *     except Exception, e:
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))             # <<<<<<<<<<<<<<
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 *         return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyTuple_New(4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_15);
      __Pyx_INCREF(__pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_v_e);
      __pyx_t_2 = 0;
      __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyString_Format(__pyx_kp_s_Exception_in_region_s_s_s_Error, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_16)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_4 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_16, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15);
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":642
 *     except Exception, e:
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_warning); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_16);
      __pyx_t_14 = 0;
      __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_Region_s_s_s_will_be_skipped, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_2, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":643
 *         logger.error('Exception in region %s:%s-%s. Error was %s' %(chrom, start, end, e))
 *         logger.warning("Region %s:%s-%s will be skipped" %(chrom, start, end))
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if readBuffers is None:
 */
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "variantcaller.pyx":637
 *     cdef Variant var, thisVar, nexVar
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         readBuffers = loadBAMData(bamFiles, chrom, start, end, options, samples, samplesByID, samplesByBAM, refSequence)
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "variantcaller.pyx":645
 *         return
 * 
 *     if readBuffers is None:             # <<<<<<<<<<<<<<
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return
 */
  __pyx_t_8 = (__pyx_v_readBuffers == ((PyObject*)Py_None));
  __pyx_t_17 = (__pyx_t_8 != 0);
  if (__pyx_t_17) {

    /* "variantcaller.pyx":646
 * 
 *     if readBuffers is None:
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_region_s_s_s_as_data_co, __pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_15, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 646, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "variantcaller.pyx":647
 *     if readBuffers is None:
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return             # <<<<<<<<<<<<<<
 * 
 * 
 */
    goto __pyx_L0;

    /* "variantcaller.pyx":645
 *         return
 * 
 *     if readBuffers is None:             # <<<<<<<<<<<<<<
 *         logger.info("Skipping region %s:%s-%s as data could not be loaded" %(chrom, start, end))
 *         return
 */
  }

  /* "variantcaller.pyx":650
 * 
 * 
 *     if options.sourceFile != None:             # <<<<<<<<<<<<<<
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 650, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_17) {

    /* "variantcaller.pyx":651
 * 
 *     if options.sourceFile != None:
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)             # <<<<<<<<<<<<<<
 * 
 *     tempSource = options.sourceFile
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_variantutils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_VariantCandidateReader); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_13 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_4, __pyx_v_options};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_4, __pyx_v_options};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_13, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_options);
      __Pyx_GIVEREF(__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_13, __pyx_v_options);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Variants); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_4 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_13 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_t_3, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_chrom, __pyx_t_3, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_13, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_13, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_13, __pyx_t_16);
      __pyx_t_3 = 0;
      __pyx_t_16 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 651, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_variantSource, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "variantcaller.pyx":650
 * 
 * 
 *     if options.sourceFile != None:             # <<<<<<<<<<<<<<
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)
 * 
 */
  }

  /* "variantcaller.pyx":653
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)
 * 
 *     tempSource = options.sourceFile             # <<<<<<<<<<<<<<
 *     options.sourceFile = None
 *     cdef list allAssemblyVariants = generateVariantsInRegion(chrom, start - options.assemblerKmerSize, end + options.assemblerKmerSize, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __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 %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 653, __pyx_L1_error)
  __pyx_v_tempSource = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":654
 * 
 *     tempSource = options.sourceFile
 *     options.sourceFile = None             # <<<<<<<<<<<<<<
 *     cdef list allAssemblyVariants = generateVariantsInRegion(chrom, start - options.assemblerKmerSize, end + options.assemblerKmerSize, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)
 *     options.sourceFile = tempSource
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile, Py_None) < 0) __PYX_ERR(0, 654, __pyx_L1_error)

  /* "variantcaller.pyx":655
 *     tempSource = options.sourceFile
 *     options.sourceFile = None
 *     cdef list allAssemblyVariants = generateVariantsInRegion(chrom, start - options.assemblerKmerSize, end + options.assemblerKmerSize, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)             # <<<<<<<<<<<<<<
 *     options.sourceFile = tempSource
 *     cdef list filteredAssemblyVariants = []
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblerKmerSize); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_assemblerKmerSize); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_f_13variantcaller_generateVariantsInRegion(__pyx_v_chrom, __pyx_t_13, __pyx_t_18, __pyx_v_bamFiles, __pyx_v_refFile, __pyx_v_options, __pyx_v_windowGenerator, __pyx_v_outputFile, __pyx_v_vcf, __pyx_v_readBuffers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allAssemblyVariants = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":656
 *     options.sourceFile = None
 *     cdef list allAssemblyVariants = generateVariantsInRegion(chrom, start - options.assemblerKmerSize, end + options.assemblerKmerSize, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)
 *     options.sourceFile = tempSource             # <<<<<<<<<<<<<<
 *     cdef list filteredAssemblyVariants = []
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s_sourceFile, __pyx_v_tempSource) < 0) __PYX_ERR(0, 656, __pyx_L1_error)

  /* "variantcaller.pyx":657
 *     cdef list allAssemblyVariants = generateVariantsInRegion(chrom, start - options.assemblerKmerSize, end + options.assemblerKmerSize, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)
 *     options.sourceFile = tempSource
 *     cdef list filteredAssemblyVariants = []             # <<<<<<<<<<<<<<
 * 
 *     for thisVar in allAssemblyVariants:
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_filteredAssemblyVariants = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":659
 *     cdef list filteredAssemblyVariants = []
 * 
 *     for thisVar in allAssemblyVariants:             # <<<<<<<<<<<<<<
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue
 */
  if (unlikely(__pyx_v_allAssemblyVariants == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 659, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_v_allAssemblyVariants; __Pyx_INCREF(__pyx_t_5); __pyx_t_19 = 0;
  for (;;) {
    if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_15 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_19); __Pyx_INCREF(__pyx_t_15); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 659, __pyx_L1_error)
    #else
    __pyx_t_15 = PySequence_ITEM(__pyx_t_5, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    #endif
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 659, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_thisVar, ((struct __pyx_obj_7variant_Variant *)__pyx_t_15));
    __pyx_t_15 = 0;

    /* "variantcaller.pyx":660
 * 
 *     for thisVar in allAssemblyVariants:
 *         if thisVar.refPos + len(thisVar.removed) < start:             # <<<<<<<<<<<<<<
 *             continue
 *         if thisVar.refPos > end :
 */
    __pyx_t_15 = __pyx_v_thisVar->removed;
    __Pyx_INCREF(__pyx_t_15);
    if (unlikely(__pyx_t_15 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 660, __pyx_L1_error)
    }
    __pyx_t_20 = PyBytes_GET_SIZE(__pyx_t_15); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_17 = (((__pyx_v_thisVar->refPos + __pyx_t_20) < __pyx_v_start) != 0);
    if (__pyx_t_17) {

      /* "variantcaller.pyx":661
 *     for thisVar in allAssemblyVariants:
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue             # <<<<<<<<<<<<<<
 *         if thisVar.refPos > end :
 *             continue
 */
      goto __pyx_L13_continue;

      /* "variantcaller.pyx":660
 * 
 *     for thisVar in allAssemblyVariants:
 *         if thisVar.refPos + len(thisVar.removed) < start:             # <<<<<<<<<<<<<<
 *             continue
 *         if thisVar.refPos > end :
 */
    }

    /* "variantcaller.pyx":662
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue
 *         if thisVar.refPos > end :             # <<<<<<<<<<<<<<
 *             continue
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:
 */
    __pyx_t_17 = ((__pyx_v_thisVar->refPos > __pyx_v_end) != 0);
    if (__pyx_t_17) {

      /* "variantcaller.pyx":663
 *             continue
 *         if thisVar.refPos > end :
 *             continue             # <<<<<<<<<<<<<<
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:
 *             continue
 */
      goto __pyx_L13_continue;

      /* "variantcaller.pyx":662
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue
 *         if thisVar.refPos > end :             # <<<<<<<<<<<<<<
 *             continue
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:
 */
    }

    /* "variantcaller.pyx":664
 *         if thisVar.refPos > end :
 *             continue
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:             # <<<<<<<<<<<<<<
 *             continue
 *         var = trimLongVar(thisVar, start, end) # the -1 is for 0-base conversion from 1-base window
 */
    __pyx_t_8 = ((__pyx_v_thisVar->varType == 3) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_17 = __pyx_t_8;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_15 = __pyx_v_thisVar->removed;
    __Pyx_INCREF(__pyx_t_15);
    if (unlikely(__pyx_t_15 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 664, __pyx_L1_error)
    }
    __pyx_t_20 = PyBytes_GET_SIZE(__pyx_t_15); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_8 = ((__pyx_t_20 > (__pyx_v_end - __pyx_v_thisVar->refPos)) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_17 = __pyx_t_8;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_15 = __pyx_v_thisVar->removed;
    __Pyx_INCREF(__pyx_t_15);
    if (unlikely(__pyx_t_15 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 664, __pyx_L1_error)
    }
    __pyx_t_20 = PyBytes_GET_SIZE(__pyx_t_15); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_8 = ((__pyx_t_20 > 0xC8) != 0);
    __pyx_t_17 = __pyx_t_8;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_17) {

      /* "variantcaller.pyx":665
 *             continue
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:
 *             continue             # <<<<<<<<<<<<<<
 *         var = trimLongVar(thisVar, start, end) # the -1 is for 0-base conversion from 1-base window
 *         filteredAssemblyVariants.append(var)
 */
      goto __pyx_L13_continue;

      /* "variantcaller.pyx":664
 *         if thisVar.refPos > end :
 *             continue
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:             # <<<<<<<<<<<<<<
 *             continue
 *         var = trimLongVar(thisVar, start, end) # the -1 is for 0-base conversion from 1-base window
 */
    }

    /* "variantcaller.pyx":666
 *         if thisVar.varType==3 and len(thisVar.removed) > end - thisVar.refPos and len(thisVar.removed) > 200:
 *             continue
 *         var = trimLongVar(thisVar, start, end) # the -1 is for 0-base conversion from 1-base window             # <<<<<<<<<<<<<<
 *         filteredAssemblyVariants.append(var)
 * 
 */
    __pyx_t_15 = ((PyObject *)__pyx_f_13variantFilter_trimLongVar(__pyx_v_thisVar, __pyx_v_start, __pyx_v_end)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_XDECREF_SET(__pyx_v_var, ((struct __pyx_obj_7variant_Variant *)__pyx_t_15));
    __pyx_t_15 = 0;

    /* "variantcaller.pyx":667
 *             continue
 *         var = trimLongVar(thisVar, start, end) # the -1 is for 0-base conversion from 1-base window
 *         filteredAssemblyVariants.append(var)             # <<<<<<<<<<<<<<
 * 
 *     cdef list longVarList=[]
 */
    __pyx_t_21 = __Pyx_PyList_Append(__pyx_v_filteredAssemblyVariants, ((PyObject *)__pyx_v_var)); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 667, __pyx_L1_error)

    /* "variantcaller.pyx":659
 *     cdef list filteredAssemblyVariants = []
 * 
 *     for thisVar in allAssemblyVariants:             # <<<<<<<<<<<<<<
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue
 */
    __pyx_L13_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":669
 *         filteredAssemblyVariants.append(var)
 * 
 *     cdef list longVarList=[]             # <<<<<<<<<<<<<<
 *     cdef list windowHapList=[]
 *     cdef list windowLongVars=[]
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_longVarList = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":670
 * 
 *     cdef list longVarList=[]
 *     cdef list windowHapList=[]             # <<<<<<<<<<<<<<
 *     cdef list windowLongVars=[]
 *     cdef int nWindow =0
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_windowHapList = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":671
 *     cdef list longVarList=[]
 *     cdef list windowHapList=[]
 *     cdef list windowLongVars=[]             # <<<<<<<<<<<<<<
 *     cdef int nWindow =0
 * 
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_windowLongVars = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":672
 *     cdef list windowHapList=[]
 *     cdef list windowLongVars=[]
 *     cdef int nWindow =0             # <<<<<<<<<<<<<<
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):
 */
  __pyx_v_nWindow = 0;

  /* "variantcaller.pyx":674
 *     cdef int nWindow =0
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):             # <<<<<<<<<<<<<<
 *         nWindow +=1
 *         try:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_5 = __pyx_int_0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_windowGenerator, __pyx_n_s_WindowsAndVariants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_maxContigPos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  __pyx_t_18 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_18 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_v_chrom, __pyx_t_16, __pyx_t_3, __pyx_t_4, __pyx_v_filteredAssemblyVariants, __pyx_v_options};
    __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_18, 6+__pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_v_chrom, __pyx_t_16, __pyx_t_3, __pyx_t_4, __pyx_v_filteredAssemblyVariants, __pyx_v_options};
    __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_18, 6+__pyx_t_18); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_14 = PyTuple_New(6+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_v_chrom);
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_18, __pyx_v_chrom);
    __Pyx_GIVEREF(__pyx_t_16);
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_18, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_18, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_18, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_filteredAssemblyVariants);
    __Pyx_GIVEREF(__pyx_v_filteredAssemblyVariants);
    PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_18, __pyx_v_filteredAssemblyVariants);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_18, __pyx_v_options);
    __pyx_t_16 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_15)) || PyTuple_CheckExact(__pyx_t_15)) {
    __pyx_t_1 = __pyx_t_15; __Pyx_INCREF(__pyx_t_1); __pyx_t_19 = 0;
    __pyx_t_22 = NULL;
  } else {
    __pyx_t_19 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_22 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 674, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  for (;;) {
    if (likely(!__pyx_t_22)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_15 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_19); __Pyx_INCREF(__pyx_t_15); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 674, __pyx_L1_error)
        #else
        __pyx_t_15 = PySequence_ITEM(__pyx_t_1, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        #endif
      } else {
        if (__pyx_t_19 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_19); __Pyx_INCREF(__pyx_t_15); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 674, __pyx_L1_error)
        #else
        __pyx_t_15 = PySequence_ITEM(__pyx_t_1, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        #endif
      }
    } else {
      __pyx_t_15 = __pyx_t_22(__pyx_t_1);
      if (unlikely(!__pyx_t_15)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 674, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_15);
    }
    if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_15)->tp_name), 0))) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_window, ((PyObject*)__pyx_t_15));
    __pyx_t_15 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_windowIndex, __pyx_t_5);
    __pyx_t_15 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_5);
    __pyx_t_5 = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "variantcaller.pyx":675
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):
 *         nWindow +=1             # <<<<<<<<<<<<<<
 *         try:
 *             chrom = window['chromosome']
 */
    __pyx_v_nWindow = (__pyx_v_nWindow + 1);

    /* "variantcaller.pyx":676
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):
 *         nWindow +=1
 *         try:             # <<<<<<<<<<<<<<
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_10);
      /*try:*/ {

        /* "variantcaller.pyx":677
 *         nWindow +=1
 *         try:
 *             chrom = window['chromosome']             # <<<<<<<<<<<<<<
 *             windowStart = window['startPos']
 *             windowEnd = window['endPos']
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 677, __pyx_L23_error)
        }
        __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_chromosome); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 677, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (!(likely(PyBytes_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_15)->tp_name), 0))) __PYX_ERR(0, 677, __pyx_L23_error)
        __Pyx_DECREF_SET(__pyx_v_chrom, ((PyObject*)__pyx_t_15));
        __pyx_t_15 = 0;

        /* "variantcaller.pyx":678
 *         try:
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *             windowEnd = window['endPos']
 * 
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 678, __pyx_L23_error)
        }
        __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 678, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_XDECREF_SET(__pyx_v_windowStart, __pyx_t_15);
        __pyx_t_15 = 0;

        /* "variantcaller.pyx":679
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']
 *             windowEnd = window['endPos']             # <<<<<<<<<<<<<<
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 679, __pyx_L23_error)
        }
        __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 679, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_XDECREF_SET(__pyx_v_windowEnd, __pyx_t_15);
        __pyx_t_15 = 0;

        /* "variantcaller.pyx":681
 *             windowEnd = window['endPos']
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue
 */
        __pyx_t_15 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_15, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_8) {
        } else {
          __pyx_t_17 = __pyx_t_8;
          goto __pyx_L32_bool_binop_done;
        }
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 681, __pyx_L23_error)
        }
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_20 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 681, __pyx_L23_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = ((__pyx_t_20 > 0) != 0);
        __pyx_t_17 = __pyx_t_8;
        __pyx_L32_bool_binop_done:;
        if (__pyx_t_17) {

          /* "variantcaller.pyx":682
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_info); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_16 = PyTuple_New(5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_INCREF(__pyx_v_chrom);
          __Pyx_GIVEREF(__pyx_v_chrom);
          PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_chrom);
          __Pyx_INCREF(__pyx_v_windowStart);
          __Pyx_GIVEREF(__pyx_v_windowStart);
          PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_windowStart);
          __Pyx_INCREF(__pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_3);
          __pyx_t_14 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_very_large_window_s_s_s, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_16 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_16)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_16);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
            }
          }
          __pyx_t_4 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_16, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_3);
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 682, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "variantcaller.pyx":683
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if len(window['variants']) > 0:
 */
          goto __pyx_L29_try_continue;

          /* "variantcaller.pyx":681
 *             windowEnd = window['endPos']
 * 
 *             if windowEnd - windowStart > options.maxSize and len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)" %(chrom, windowStart, windowEnd, windowEnd - windowStart, options.maxSize))
 *                 continue
 */
        }

        /* "variantcaller.pyx":685
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 *                 longVarList.extend(windowLongVars)
 */
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 685, __pyx_L23_error)
        }
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_20 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_20 == ((Py_ssize_t)-1))) __PYX_ERR(0, 685, __pyx_L23_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_17 = ((__pyx_t_20 > 0) != 0);
        if (__pyx_t_17) {

          /* "variantcaller.pyx":686
 * 
 *             if len(window['variants']) > 0:
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)             # <<<<<<<<<<<<<<
 *                 longVarList.extend(windowLongVars)
 *         except Exception, e:
 */
          __pyx_t_4 = __pyx_f_13variantcaller_callHLAVariantsInWindow(__pyx_v_window, __pyx_v_options, __pyx_v_refFile, __pyx_v_readBuffers, __pyx_v_pop, __pyx_v_start, __pyx_v_end, __pyx_v_refSequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 686, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_windowLongVars, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "variantcaller.pyx":687
 *             if len(window['variants']) > 0:
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 *                 longVarList.extend(windowLongVars)             # <<<<<<<<<<<<<<
 *         except Exception, e:
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))
 */
          __pyx_t_21 = __Pyx_PyList_Extend(__pyx_v_longVarList, __pyx_v_windowLongVars); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 687, __pyx_L23_error)

          /* "variantcaller.pyx":685
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 *                 longVarList.extend(windowLongVars)
 */
        }

        /* "variantcaller.pyx":676
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):
 *         nWindow +=1
 *         try:             # <<<<<<<<<<<<<<
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']
 */
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L30_try_end;
      __pyx_L23_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":688
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 *                 longVarList.extend(windowLongVars)
 *         except Exception, e:             # <<<<<<<<<<<<<<
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))
 */
      __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_18) {
        __Pyx_AddTraceback("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_15, &__pyx_t_3) < 0) __PYX_ERR(0, 688, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_15);

        /* "variantcaller.pyx":689
 *                 longVarList.extend(windowLongVars)
 *         except Exception, e:
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))             # <<<<<<<<<<<<<<
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 689, __pyx_L25_except_error)
        }
        __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 689, __pyx_L25_except_error)
        }
        __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_24 = PyTuple_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_23);
        PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_23);
        __Pyx_INCREF(__pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_24, 2, __pyx_v_e);
        __pyx_t_14 = 0;
        __pyx_t_23 = 0;
        __pyx_t_23 = __Pyx_PyString_Format(__pyx_kp_s_Exception_in_window_d_d_Error_wa, __pyx_t_24); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_23);
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __pyx_t_24 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_24)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_24);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_16 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_24, __pyx_t_23) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_23);
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 689, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

        /* "variantcaller.pyx":690
 *         except Exception, e:
 *             logger.exception('Exception in window %d-%d. Error was %s' %(window['startPos'],window['endPos'], e))
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))             # <<<<<<<<<<<<<<
 * 
 *     cdef list allVarSourceHaplotypes = []
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_23);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 690, __pyx_L25_except_error)
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(__pyx_v_window == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 690, __pyx_L25_except_error)
        }
        __pyx_t_24 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_v_chrom);
        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_chrom);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_24);
        __pyx_t_2 = 0;
        __pyx_t_24 = 0;
        __pyx_t_24 = __Pyx_PyString_Format(__pyx_kp_s_Window_s_s_s_will_be_skipped, __pyx_t_14); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_23);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_23, function);
          }
        }
        __pyx_t_16 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_14, __pyx_t_24) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_t_24);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 690, __pyx_L25_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L24_exception_handled;
      }
      goto __pyx_L25_except_error;
      __pyx_L25_except_error:;

      /* "variantcaller.pyx":676
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):
 *         nWindow +=1
 *         try:             # <<<<<<<<<<<<<<
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']
 */
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L1_error;
      __pyx_L29_try_continue:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      goto __pyx_L21_continue;
      __pyx_L24_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      __pyx_L30_try_end:;
    }

    /* "variantcaller.pyx":674
 *     cdef int nWindow =0
 * 
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, filteredAssemblyVariants, options)):             # <<<<<<<<<<<<<<
 *         nWindow +=1
 *         try:
 */
    __pyx_L21_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":692
 *             logger.warning("Window %s:%s-%s will be skipped" %(chrom, window['startPos'],window['endPos']))
 * 
 *     cdef list allVarSourceHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allAssemblerHaplotypes = []
 *     cdef list allHaplotypes = []
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allVarSourceHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":693
 * 
 *     cdef list allVarSourceHaplotypes = []
 *     cdef list allAssemblerHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allHaplotypes = []
 *     cdef list allUniqueHaplotypes = []
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allAssemblerHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":694
 *     cdef list allVarSourceHaplotypes = []
 *     cdef list allAssemblerHaplotypes = []
 *     cdef list allHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allUniqueHaplotypes = []
 *     cdef list allGenotypes = []
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":695
 *     cdef list allAssemblerHaplotypes = []
 *     cdef list allHaplotypes = []
 *     cdef list allUniqueHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allGenotypes = []
 *     cdef Haplotype refHaplotype  = Haplotype(chrom, start, end, (), refFile, options.rlen, options)
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":696
 *     cdef list allHaplotypes = []
 *     cdef list allUniqueHaplotypes = []
 *     cdef list allGenotypes = []             # <<<<<<<<<<<<<<
 *     cdef Haplotype refHaplotype  = Haplotype(chrom, start, end, (), refFile, options.rlen, options)
 *     cdef Haplotype hap
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":697
 *     cdef list allUniqueHaplotypes = []
 *     cdef list allGenotypes = []
 *     cdef Haplotype refHaplotype  = Haplotype(chrom, start, end, (), refFile, options.rlen, options)             # <<<<<<<<<<<<<<
 *     cdef Haplotype hap
 *     cdef int maxEMIterations = 100
 */
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rlen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_15 = PyTuple_New(7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1);
  __Pyx_INCREF(__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_empty_tuple);
  PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_empty_tuple);
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_15, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_v_options);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_10chaplotype_Haplotype), __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_v_refHaplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "variantcaller.pyx":699
 *     cdef Haplotype refHaplotype  = Haplotype(chrom, start, end, (), refFile, options.rlen, options)
 *     cdef Haplotype hap
 *     cdef int maxEMIterations = 100             # <<<<<<<<<<<<<<
 *     cdef list longVars
 *     cdef DiploidGenotype gt
 */
  __pyx_v_maxEMIterations = 0x64;

  /* "variantcaller.pyx":703
 *     cdef DiploidGenotype gt
 *     cdef Haplotype hap1, hap2
 *     cdef int nUniqueHaplotypes = 0             # <<<<<<<<<<<<<<
 * 
 *     for readBuffer in readBuffers:
 */
  __pyx_v_nUniqueHaplotypes = 0;

  /* "variantcaller.pyx":705
 *     cdef int nUniqueHaplotypes = 0
 * 
 *     for readBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)
 *     if variantSource!= None:
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 705, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_3); __pyx_t_19 = 0;
  for (;;) {
    if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_15 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_19); __Pyx_INCREF(__pyx_t_15); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 705, __pyx_L1_error)
    #else
    __pyx_t_15 = PySequence_ITEM(__pyx_t_3, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    #endif
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 705, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_readBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_15));
    __pyx_t_15 = 0;

    /* "variantcaller.pyx":706
 * 
 *     for readBuffer in readBuffers:
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)             # <<<<<<<<<<<<<<
 *     if variantSource!= None:
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)
 */
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qualBinSize); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 706, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_readBuffer->__pyx_vtab)->setWindowPointers(__pyx_v_readBuffer, __pyx_v_start, __pyx_v_end, __pyx_v_start, __pyx_v_end, __pyx_v_refSequence, __pyx_t_18);

    /* "variantcaller.pyx":705
 *     cdef int nUniqueHaplotypes = 0
 * 
 *     for readBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)
 *     if variantSource!= None:
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":707
 *     for readBuffer in readBuffers:
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)
 *     if variantSource!= None:             # <<<<<<<<<<<<<<
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)
 * 
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_variantSource, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 707, __pyx_L1_error)
  __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_17) {

    /* "variantcaller.pyx":708
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)
 *     if variantSource!= None:
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     if nWindow == 0:
 */
    __pyx_t_3 = __pyx_f_13variantFilter_getAllHLAHaplotypesInRegion(__pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_refFile, __pyx_v_options, __pyx_v_variantSource, __pyx_v_refHaplotype, __pyx_v_readBuffers); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_allVarSourceHaplotypes, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":707
 *     for readBuffer in readBuffers:
 *         readBuffer.setWindowPointers(start, end, start, end, refSequence, options.qualBinSize)
 *     if variantSource!= None:             # <<<<<<<<<<<<<<
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)
 * 
 */
  }

  /* "variantcaller.pyx":710
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)
 * 
 *     if nWindow == 0:             # <<<<<<<<<<<<<<
 *         if  end - start < 10:
 *             ref = refFile.getSequence(chrom, start, end)
 */
  __pyx_t_17 = ((__pyx_v_nWindow == 0) != 0);
  if (__pyx_t_17) {

    /* "variantcaller.pyx":711
 * 
 *     if nWindow == 0:
 *         if  end - start < 10:             # <<<<<<<<<<<<<<
 *             ref = refFile.getSequence(chrom, start, end)
 *             format = 'GT:GL:NR:NV1:NV2'
 */
    __pyx_t_17 = (((__pyx_v_end - __pyx_v_start) < 10) != 0);
    if (__pyx_t_17) {

      /* "variantcaller.pyx":712
 *     if nWindow == 0:
 *         if  end - start < 10:
 *             ref = refFile.getSequence(chrom, start, end)             # <<<<<<<<<<<<<<
 *             format = 'GT:GL:NR:NV1:NV2'
 *             infoLine = "WS=" + str(start) + ";WE=" + str(end) + ";Size=" + str(end - start + 1)
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_start, __pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_v_ref = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":713
 *         if  end - start < 10:
 *             ref = refFile.getSequence(chrom, start, end)
 *             format = 'GT:GL:NR:NV1:NV2'             # <<<<<<<<<<<<<<
 *             infoLine = "WS=" + str(start) + ";WE=" + str(end) + ";Size=" + str(end - start + 1)
 *             theLine = "\t".join([chrom, str(start+1),'.', ref, ".", "100", "REFCALL", infoLine, format])
 */
      __Pyx_INCREF(__pyx_kp_s_GT_GL_NR_NV1_NV2);
      __pyx_v_format = __pyx_kp_s_GT_GL_NR_NV1_NV2;

      /* "variantcaller.pyx":714
 *             ref = refFile.getSequence(chrom, start, end)
 *             format = 'GT:GL:NR:NV1:NV2'
 *             infoLine = "WS=" + str(start) + ";WE=" + str(end) + ";Size=" + str(end - start + 1)             # <<<<<<<<<<<<<<
 *             theLine = "\t".join([chrom, str(start+1),'.', ref, ".", "100", "REFCALL", infoLine, format])
 *             for i from 0 <= i < options.nInd:
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s_WS, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyNumber_Add(__pyx_t_3, __pyx_kp_s_WE); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_t_15, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_kp_s_Size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_end - __pyx_v_start) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_v_infoLine = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "variantcaller.pyx":715
 *             format = 'GT:GL:NR:NV1:NV2'
 *             infoLine = "WS=" + str(start) + ";WE=" + str(end) + ";Size=" + str(end - start + 1)
 *             theLine = "\t".join([chrom, str(start+1),'.', ref, ".", "100", "REFCALL", infoLine, format])             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < options.nInd:
 *                 readBuffer = readBuffers[i]
 */
      __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_start + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_15);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s__2);
      __Pyx_INCREF(__pyx_v_ref);
      __Pyx_GIVEREF(__pyx_v_ref);
      PyList_SET_ITEM(__pyx_t_3, 3, __pyx_v_ref);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_s__2);
      __Pyx_INCREF(__pyx_kp_s_100);
      __Pyx_GIVEREF(__pyx_kp_s_100);
      PyList_SET_ITEM(__pyx_t_3, 5, __pyx_kp_s_100);
      __Pyx_INCREF(__pyx_n_s_REFCALL);
      __Pyx_GIVEREF(__pyx_n_s_REFCALL);
      PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_REFCALL);
      __Pyx_INCREF(__pyx_v_infoLine);
      __Pyx_GIVEREF(__pyx_v_infoLine);
      PyList_SET_ITEM(__pyx_t_3, 7, __pyx_v_infoLine);
      __Pyx_INCREF(__pyx_v_format);
      __Pyx_GIVEREF(__pyx_v_format);
      PyList_SET_ITEM(__pyx_t_3, 8, __pyx_v_format);
      __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 715, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_theLine = ((PyObject*)__pyx_t_15);
      __pyx_t_15 = 0;

      /* "variantcaller.pyx":716
 *             infoLine = "WS=" + str(start) + ";WE=" + str(end) + ";Size=" + str(end - start + 1)
 *             theLine = "\t".join([chrom, str(start+1),'.', ref, ".", "100", "REFCALL", infoLine, format])
 *             for i from 0 <= i < options.nInd:             # <<<<<<<<<<<<<<
 *                 readBuffer = readBuffers[i]
 *                 nReads = readBuffer.reads.windowEnd - readBuffer.reads.windowStart
 */
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_nInd); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_19 = __Pyx_PyIndex_AsSsize_t(__pyx_t_15); if (unlikely((__pyx_t_19 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_19; __pyx_v_i++) {

        /* "variantcaller.pyx":717
 *             theLine = "\t".join([chrom, str(start+1),'.', ref, ".", "100", "REFCALL", infoLine, format])
 *             for i from 0 <= i < options.nInd:
 *                 readBuffer = readBuffers[i]             # <<<<<<<<<<<<<<
 *                 nReads = readBuffer.reads.windowEnd - readBuffer.reads.windowStart
 *                 sampleLine = ":".join(['0/0', '0.0', str(nReads), str(nReads), str(nReads)])
 */
        if (unlikely(__pyx_v_readBuffers == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 717, __pyx_L1_error)
        }
        __pyx_t_15 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 717, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_readBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_15));
        __pyx_t_15 = 0;

        /* "variantcaller.pyx":718
 *             for i from 0 <= i < options.nInd:
 *                 readBuffer = readBuffers[i]
 *                 nReads = readBuffer.reads.windowEnd - readBuffer.reads.windowStart             # <<<<<<<<<<<<<<
 *                 sampleLine = ":".join(['0/0', '0.0', str(nReads), str(nReads), str(nReads)])
 *                 theLine += "\t" + sampleLine
 */
        __pyx_v_nReads = (__pyx_v_readBuffer->reads->windowEnd - __pyx_v_readBuffer->reads->windowStart);

        /* "variantcaller.pyx":719
 *                 readBuffer = readBuffers[i]
 *                 nReads = readBuffer.reads.windowEnd - readBuffer.reads.windowStart
 *                 sampleLine = ":".join(['0/0', '0.0', str(nReads), str(nReads), str(nReads)])             # <<<<<<<<<<<<<<
 *                 theLine += "\t" + sampleLine
 *             outputFile.write("%s\n" %(theLine))
 */
        __pyx_t_15 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_nReads); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_nReads); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyInt_From_ptrdiff_t(__pyx_v_nReads); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = PyList_New(5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_kp_s_0_0);
        __Pyx_GIVEREF(__pyx_kp_s_0_0);
        PyList_SET_ITEM(__pyx_t_15, 0, __pyx_kp_s_0_0);
        __Pyx_INCREF(__pyx_kp_s_0_0_2);
        __Pyx_GIVEREF(__pyx_kp_s_0_0_2);
        PyList_SET_ITEM(__pyx_t_15, 1, __pyx_kp_s_0_0_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_15, 2, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1);
        PyList_SET_ITEM(__pyx_t_15, 3, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        PyList_SET_ITEM(__pyx_t_15, 4, __pyx_t_5);
        __pyx_t_3 = 0;
        __pyx_t_1 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__3, __pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF_SET(__pyx_v_sampleLine, ((PyObject*)__pyx_t_5));
        __pyx_t_5 = 0;

        /* "variantcaller.pyx":720
 *                 nReads = readBuffer.reads.windowEnd - readBuffer.reads.windowStart
 *                 sampleLine = ":".join(['0/0', '0.0', str(nReads), str(nReads), str(nReads)])
 *                 theLine += "\t" + sampleLine             # <<<<<<<<<<<<<<
 *             outputFile.write("%s\n" %(theLine))
 *             return
 */
        __pyx_t_5 = PyNumber_Add(__pyx_kp_s_, __pyx_v_sampleLine); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_v_theLine, __pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_theLine, ((PyObject*)__pyx_t_15));
        __pyx_t_15 = 0;
      }

      /* "variantcaller.pyx":721
 *                 sampleLine = ":".join(['0/0', '0.0', str(nReads), str(nReads), str(nReads)])
 *                 theLine += "\t" + sampleLine
 *             outputFile.write("%s\n" %(theLine))             # <<<<<<<<<<<<<<
 *             return
 *         else:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_outputFile, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_theLine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_15 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

      /* "variantcaller.pyx":722
 *                 theLine += "\t" + sampleLine
 *             outputFile.write("%s\n" %(theLine))
 *             return             # <<<<<<<<<<<<<<
 *         else:
 *             allHaplotypes = allVarSourceHaplotypes
 */
      goto __pyx_L0;

      /* "variantcaller.pyx":711
 * 
 *     if nWindow == 0:
 *         if  end - start < 10:             # <<<<<<<<<<<<<<
 *             ref = refFile.getSequence(chrom, start, end)
 *             format = 'GT:GL:NR:NV1:NV2'
 */
    }

    /* "variantcaller.pyx":724
 *             return
 *         else:
 *             allHaplotypes = allVarSourceHaplotypes             # <<<<<<<<<<<<<<
 *     else:
 *         allAssemblerHaplotypes = variantFilter.getAllAssemblerHaplotypesInRegion(chrom, start, end, refFile, options, sorted(longVarList), refHaplotype, readBuffers)
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_allVarSourceHaplotypes);
      __Pyx_DECREF_SET(__pyx_v_allHaplotypes, __pyx_v_allVarSourceHaplotypes);
    }

    /* "variantcaller.pyx":710
 *         allVarSourceHaplotypes = variantFilter.getAllHLAHaplotypesInRegion(chrom, start, end, refFile, options, variantSource, refHaplotype, readBuffers)
 * 
 *     if nWindow == 0:             # <<<<<<<<<<<<<<
 *         if  end - start < 10:
 *             ref = refFile.getSequence(chrom, start, end)
 */
    goto __pyx_L40;
  }

  /* "variantcaller.pyx":726
 *             allHaplotypes = allVarSourceHaplotypes
 *     else:
 *         allAssemblerHaplotypes = variantFilter.getAllAssemblerHaplotypesInRegion(chrom, start, end, refFile, options, sorted(longVarList), refHaplotype, readBuffers)             # <<<<<<<<<<<<<<
 *         allHaplotypes =  allAssemblerHaplotypes +  allVarSourceHaplotypes
 * 
 */
  /*else*/ {
    __pyx_t_5 = PySequence_List(__pyx_v_longVarList); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_15 = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_21 = PyList_Sort(__pyx_t_15); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 726, __pyx_L1_error)
    __pyx_t_5 = __pyx_f_13variantFilter_getAllAssemblerHaplotypesInRegion(__pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_refFile, __pyx_v_options, ((PyObject*)__pyx_t_15), __pyx_v_refHaplotype, __pyx_v_readBuffers); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_allAssemblerHaplotypes, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "variantcaller.pyx":727
 *     else:
 *         allAssemblerHaplotypes = variantFilter.getAllAssemblerHaplotypesInRegion(chrom, start, end, refFile, options, sorted(longVarList), refHaplotype, readBuffers)
 *         allHaplotypes =  allAssemblerHaplotypes +  allVarSourceHaplotypes             # <<<<<<<<<<<<<<
 * 
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)
 */
    __pyx_t_5 = PyNumber_Add(__pyx_v_allAssemblerHaplotypes, __pyx_v_allVarSourceHaplotypes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_allHaplotypes, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;
  }
  __pyx_L40:;

  /* "variantcaller.pyx":729
 *         allHaplotypes =  allAssemblerHaplotypes +  allVarSourceHaplotypes
 * 
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)             # <<<<<<<<<<<<<<
 *     for i, hap in enumerate(allUniqueHaplotypes):
 *         logger.debug('Haplotype %d: %s' %(i, str(hap)))
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_15 = PyNumber_Add(__pyx_t_5, __pyx_v_allHaplotypes); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_15), __pyx_v_refFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF_SET(__pyx_v_allUniqueHaplotypes, ((PyObject*)__pyx_t_5));
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":730
 * 
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)
 *     for i, hap in enumerate(allUniqueHaplotypes):             # <<<<<<<<<<<<<<
 *         logger.debug('Haplotype %d: %s' %(i, str(hap)))
 * 
 */
  __pyx_t_19 = 0;
  __pyx_t_5 = __pyx_v_allUniqueHaplotypes; __Pyx_INCREF(__pyx_t_5); __pyx_t_20 = 0;
  for (;;) {
    if (__pyx_t_20 >= PyList_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_15 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_20); __Pyx_INCREF(__pyx_t_15); __pyx_t_20++; if (unlikely(0 < 0)) __PYX_ERR(0, 730, __pyx_L1_error)
    #else
    __pyx_t_15 = PySequence_ITEM(__pyx_t_5, __pyx_t_20); __pyx_t_20++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    #endif
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 730, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_hap, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_15));
    __pyx_t_15 = 0;
    __pyx_v_i = __pyx_t_19;
    __pyx_t_19 = (__pyx_t_19 + 1);

    /* "variantcaller.pyx":731
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)
 *     for i, hap in enumerate(allUniqueHaplotypes):
 *         logger.debug('Haplotype %d: %s' %(i, str(hap)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)__pyx_v_hap)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Haplotype_d_s, __pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_15 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_16, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

    /* "variantcaller.pyx":730
 * 
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)
 *     for i, hap in enumerate(allUniqueHaplotypes):             # <<<<<<<<<<<<<<
 *         logger.debug('Haplotype %d: %s' %(i, str(hap)))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":734
 * 
 * 
 *     readBuffer = readBuffers[0]             # <<<<<<<<<<<<<<
 *     tempReads = readBuffer.reads.windowStart
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 734, __pyx_L1_error)
  }
  if (!(likely(((PyList_GET_ITEM(__pyx_v_readBuffers, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_readBuffers, 0), __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 734, __pyx_L1_error)
  __pyx_t_5 = PyList_GET_ITEM(__pyx_v_readBuffers, 0);
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_XDECREF_SET(__pyx_v_readBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_5));
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":735
 * 
 *     readBuffer = readBuffers[0]
 *     tempReads = readBuffer.reads.windowStart             # <<<<<<<<<<<<<<
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:
 *         theRead=tempReads[0]
 */
  __pyx_t_25 = __pyx_v_readBuffer->reads->windowStart;
  __pyx_v_tempReads = __pyx_t_25;

  /* "variantcaller.pyx":736
 *     readBuffer = readBuffers[0]
 *     tempReads = readBuffer.reads.windowStart
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:             # <<<<<<<<<<<<<<
 *         theRead=tempReads[0]
 *     outputHLACallToVCF(allUniqueHaplotypes,  readBuffers, options.nInd, refFile, outputFile, options, start, end)
 */
  __pyx_t_17 = (((__pyx_v_readBuffer->reads->windowEnd - __pyx_v_readBuffer->reads->windowStart) > 0) != 0);
  if (__pyx_t_17) {

    /* "variantcaller.pyx":737
 *     tempReads = readBuffer.reads.windowStart
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:
 *         theRead=tempReads[0]             # <<<<<<<<<<<<<<
 *     outputHLACallToVCF(allUniqueHaplotypes,  readBuffers, options.nInd, refFile, outputFile, options, start, end)
 * ###################################################################################################
 */
    __pyx_v_theRead = (__pyx_v_tempReads[0]);

    /* "variantcaller.pyx":736
 *     readBuffer = readBuffers[0]
 *     tempReads = readBuffer.reads.windowStart
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:             # <<<<<<<<<<<<<<
 *         theRead=tempReads[0]
 *     outputHLACallToVCF(allUniqueHaplotypes,  readBuffers, options.nInd, refFile, outputFile, options, start, end)
 */
  }

  /* "variantcaller.pyx":738
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:
 *         theRead=tempReads[0]
 *     outputHLACallToVCF(allUniqueHaplotypes,  readBuffers, options.nInd, refFile, outputFile, options, start, end)             # <<<<<<<<<<<<<<
 * ###################################################################################################
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_nInd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_f_8vcfutils_outputHLACallToVCF(__pyx_v_allUniqueHaplotypes, __pyx_v_readBuffers, __pyx_t_18, __pyx_v_refFile, __pyx_v_outputFile, __pyx_v_options, __pyx_v_start, __pyx_v_end);

  /* "variantcaller.pyx":619
 * ###################################################################################################
 * ###################################################################################################
 * cdef void callHLAVariantsInRegion(bytes chrom, int start, int end, bamFiles, FastaFile refFile, options, windowGenerator, outputFile, vcf, list samples, dict samplesByID, dict samplesByBAM, Population pop):             # <<<<<<<<<<<<<<
 *     """
 *     Given a set of BAM files, and a sensibly-sized genomic region (typically ~1MB), call variants in the specified region.
 */

  /* function exit code */
  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_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_WriteUnraisable("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_refSequenceBytes);
  __Pyx_XDECREF(__pyx_v_window);
  __Pyx_XDECREF(__pyx_v_readBuffers);
  __Pyx_XDECREF((PyObject *)__pyx_v_readBuffer);
  __Pyx_XDECREF(__pyx_v_variantSource);
  __Pyx_XDECREF(__pyx_v_tempSource);
  __Pyx_XDECREF((PyObject *)__pyx_v_var);
  __Pyx_XDECREF((PyObject *)__pyx_v_thisVar);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_allAssemblyVariants);
  __Pyx_XDECREF(__pyx_v_filteredAssemblyVariants);
  __Pyx_XDECREF(__pyx_v_longVarList);
  __Pyx_XDECREF(__pyx_v_windowHapList);
  __Pyx_XDECREF(__pyx_v_windowLongVars);
  __Pyx_XDECREF(__pyx_v_windowIndex);
  __Pyx_XDECREF(__pyx_v_windowStart);
  __Pyx_XDECREF(__pyx_v_windowEnd);
  __Pyx_XDECREF(__pyx_v_allVarSourceHaplotypes);
  __Pyx_XDECREF(__pyx_v_allAssemblerHaplotypes);
  __Pyx_XDECREF(__pyx_v_allHaplotypes);
  __Pyx_XDECREF(__pyx_v_allUniqueHaplotypes);
  __Pyx_XDECREF(__pyx_v_allGenotypes);
  __Pyx_XDECREF((PyObject *)__pyx_v_refHaplotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XDECREF(__pyx_v_infoLine);
  __Pyx_XDECREF(__pyx_v_theLine);
  __Pyx_XDECREF(__pyx_v_sampleLine);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_RefNannyFinishContext();
}

/* "variantcaller.pyx":741
 * ###################################################################################################
 * 
 * cdef int sumMapQualsTimesReadLength(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return the sum of mapping quality phred scores of all good-quality reads
 */

static int __pyx_f_13variantcaller_sumMapQualsTimesReadLength(PyObject *__pyx_v_readBuffers) {
  int __pyx_v_result;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theBuffer = 0;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_rStart;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_rEnd;
  long __pyx_v_i;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("sumMapQualsTimesReadLength", 0);

  /* "variantcaller.pyx":746
 *     mapping to this region multuplied by the read lengths.
 *     """
 *     cdef int result = 0             # <<<<<<<<<<<<<<
 *     cdef bamReadBuffer theBuffer
 *     cdef cAlignedRead** rStart = NULL
 */
  __pyx_v_result = 0;

  /* "variantcaller.pyx":748
 *     cdef int result = 0
 *     cdef bamReadBuffer theBuffer
 *     cdef cAlignedRead** rStart = NULL             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead** rEnd = NULL
 * 
 */
  __pyx_v_rStart = NULL;

  /* "variantcaller.pyx":749
 *     cdef bamReadBuffer theBuffer
 *     cdef cAlignedRead** rStart = NULL
 *     cdef cAlignedRead** rEnd = NULL             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < len(readBuffers):
 */
  __pyx_v_rEnd = NULL;

  /* "variantcaller.pyx":751
 *     cdef cAlignedRead** rEnd = NULL
 * 
 *     for i from 0 <= i < len(readBuffers):             # <<<<<<<<<<<<<<
 *         theBuffer = readBuffers[i]
 *         rStart = theBuffer.reads.windowStart
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 751, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_readBuffers); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 751, __pyx_L1_error)
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "variantcaller.pyx":752
 * 
 *     for i from 0 <= i < len(readBuffers):
 *         theBuffer = readBuffers[i]             # <<<<<<<<<<<<<<
 *         rStart = theBuffer.reads.windowStart
 *         rEnd = theBuffer.reads.windowEnd
 */
    if (unlikely(__pyx_v_readBuffers == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 752, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 752, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "variantcaller.pyx":753
 *     for i from 0 <= i < len(readBuffers):
 *         theBuffer = readBuffers[i]
 *         rStart = theBuffer.reads.windowStart             # <<<<<<<<<<<<<<
 *         rEnd = theBuffer.reads.windowEnd
 * 
 */
    __pyx_t_3 = __pyx_v_theBuffer->reads->windowStart;
    __pyx_v_rStart = __pyx_t_3;

    /* "variantcaller.pyx":754
 *         theBuffer = readBuffers[i]
 *         rStart = theBuffer.reads.windowStart
 *         rEnd = theBuffer.reads.windowEnd             # <<<<<<<<<<<<<<
 * 
 *         while rStart != rEnd:
 */
    __pyx_t_3 = __pyx_v_theBuffer->reads->windowEnd;
    __pyx_v_rEnd = __pyx_t_3;

    /* "variantcaller.pyx":756
 *         rEnd = theBuffer.reads.windowEnd
 * 
 *         while rStart != rEnd:             # <<<<<<<<<<<<<<
 *             result += (rStart[0].mapq*rStart[0].rlen)
 *             rStart += 1
 */
    while (1) {
      __pyx_t_4 = ((__pyx_v_rStart != __pyx_v_rEnd) != 0);
      if (!__pyx_t_4) break;

      /* "variantcaller.pyx":757
 * 
 *         while rStart != rEnd:
 *             result += (rStart[0].mapq*rStart[0].rlen)             # <<<<<<<<<<<<<<
 *             rStart += 1
 * 
 */
      __pyx_v_result = (__pyx_v_result + ((__pyx_v_rStart[0])->mapq * (__pyx_v_rStart[0])->rlen));

      /* "variantcaller.pyx":758
 *         while rStart != rEnd:
 *             result += (rStart[0].mapq*rStart[0].rlen)
 *             rStart += 1             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_v_rStart = (__pyx_v_rStart + 1);
    }
  }

  /* "variantcaller.pyx":760
 *             rStart += 1
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "variantcaller.pyx":741
 * ###################################################################################################
 * 
 * cdef int sumMapQualsTimesReadLength(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return the sum of mapping quality phred scores of all good-quality reads
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("variantcaller.sumMapQualsTimesReadLength", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theBuffer);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":764
 * ###################################################################################################
 * 
 * def outputRefCall(bytes chrom, Population pop, vcfFile, FastaFile refFile, outputFile, int windowIndex, dict window, options, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_3outputRefCall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_13variantcaller_2outputRefCall[] = "\n    ";
static PyMethodDef __pyx_mdef_13variantcaller_3outputRefCall = {"outputRefCall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_13variantcaller_3outputRefCall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_13variantcaller_2outputRefCall};
static PyObject *__pyx_pw_13variantcaller_3outputRefCall(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chrom = 0;
  struct __pyx_obj_11cpopulation_Population *__pyx_v_pop = 0;
  PyObject *__pyx_v_vcfFile = 0;
  struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile = 0;
  PyObject *__pyx_v_outputFile = 0;
  CYTHON_UNUSED int __pyx_v_windowIndex;
  PyObject *__pyx_v_window = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  PyObject *__pyx_v_readBuffers = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outputRefCall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chrom,&__pyx_n_s_pop,&__pyx_n_s_vcfFile,&__pyx_n_s_refFile,&__pyx_n_s_outputFile,&__pyx_n_s_windowIndex,&__pyx_n_s_window,&__pyx_n_s_options,&__pyx_n_s_readBuffers,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chrom)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 1); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vcfFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 2); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_refFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 3); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outputFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 4); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_windowIndex)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 5); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 6); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 7); __PYX_ERR(0, 764, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_readBuffers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 8); __PYX_ERR(0, 764, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outputRefCall") < 0)) __PYX_ERR(0, 764, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
      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);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
    }
    __pyx_v_chrom = ((PyObject*)values[0]);
    __pyx_v_pop = ((struct __pyx_obj_11cpopulation_Population *)values[1]);
    __pyx_v_vcfFile = values[2];
    __pyx_v_refFile = ((struct __pyx_obj_9fastafile_FastaFile *)values[3]);
    __pyx_v_outputFile = values[4];
    __pyx_v_windowIndex = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_windowIndex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L3_error)
    __pyx_v_window = ((PyObject*)values[6]);
    __pyx_v_options = values[7];
    __pyx_v_readBuffers = ((PyObject*)values[8]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 764, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("variantcaller.outputRefCall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chrom), (&PyBytes_Type), 1, "chrom", 1))) __PYX_ERR(0, 764, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_11cpopulation_Population, 1, "pop", 0))) __PYX_ERR(0, 764, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refFile), __pyx_ptype_9fastafile_FastaFile, 1, "refFile", 0))) __PYX_ERR(0, 764, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), (&PyDict_Type), 1, "window", 1))) __PYX_ERR(0, 764, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_readBuffers), (&PyList_Type), 1, "readBuffers", 1))) __PYX_ERR(0, 764, __pyx_L1_error)
  __pyx_r = __pyx_pf_13variantcaller_2outputRefCall(__pyx_self, __pyx_v_chrom, __pyx_v_pop, __pyx_v_vcfFile, __pyx_v_refFile, __pyx_v_outputFile, __pyx_v_windowIndex, __pyx_v_window, __pyx_v_options, __pyx_v_readBuffers);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_2outputRefCall(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chrom, struct __pyx_obj_11cpopulation_Population *__pyx_v_pop, PyObject *__pyx_v_vcfFile, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_outputFile, CYTHON_UNUSED int __pyx_v_windowIndex, PyObject *__pyx_v_window, CYTHON_UNUSED PyObject *__pyx_v_options, PyObject *__pyx_v_readBuffers) {
  int __pyx_v_windowStart;
  int __pyx_v_windowEnd;
  int __pyx_v_windowSize;
  PyObject *__pyx_v_variants = 0;
  int __pyx_v_nIndividuals;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theBuffer = 0;
  int __pyx_v_minCov;
  int __pyx_v_theStart;
  int __pyx_v_granularity;
  CYTHON_UNUSED Py_ssize_t __pyx_v_index;
  int __pyx_v_phredPValue;
  PyObject *__pyx_v_qual = NULL;
  PyObject *__pyx_v_maxPost = NULL;
  PyObject *__pyx_v_maxProbVar = NULL;
  PyObject *__pyx_v_probRef = NULL;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_alt = NULL;
  PyObject *__pyx_v_id = NULL;
  PyObject *__pyx_v_linefilter = NULL;
  PyObject *__pyx_v_lineinfo = NULL;
  PyObject *__pyx_v_theFormat = NULL;
  PyObject *__pyx_v_vcfDataLine = NULL;
  long __pyx_v_i;
  PyObject *__pyx_v_thisSample = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  double __pyx_t_14;
  struct __pyx_opt_args_11cpopulation_10Population_calculatePosterior __pyx_t_15;
  int __pyx_t_16;
  __Pyx_RefNannySetupContext("outputRefCall", 0);

  /* "variantcaller.pyx":767
 *     """
 *     """
 *     cdef int windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *     cdef int windowEnd = window['endPos']
 *     cdef int windowSize = windowEnd - windowStart
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 767, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_startPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowStart = __pyx_t_2;

  /* "variantcaller.pyx":768
 *     """
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']             # <<<<<<<<<<<<<<
 *     cdef int windowSize = windowEnd - windowStart
 *     cdef list variants = window['variants']
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 768, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_endPos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_windowEnd = __pyx_t_2;

  /* "variantcaller.pyx":769
 *     cdef int windowStart = window['startPos']
 *     cdef int windowEnd = window['endPos']
 *     cdef int windowSize = windowEnd - windowStart             # <<<<<<<<<<<<<<
 *     cdef list variants = window['variants']
 *     cdef int nIndividuals = len(readBuffers)
 */
  __pyx_v_windowSize = (__pyx_v_windowEnd - __pyx_v_windowStart);

  /* "variantcaller.pyx":770
 *     cdef int windowEnd = window['endPos']
 *     cdef int windowSize = windowEnd - windowStart
 *     cdef list variants = window['variants']             # <<<<<<<<<<<<<<
 *     cdef int nIndividuals = len(readBuffers)
 *     cdef bamReadBuffer theBuffer
 */
  if (unlikely(__pyx_v_window == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 770, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_window, __pyx_n_s_variants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 770, __pyx_L1_error)
  __pyx_v_variants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":771
 *     cdef int windowSize = windowEnd - windowStart
 *     cdef list variants = window['variants']
 *     cdef int nIndividuals = len(readBuffers)             # <<<<<<<<<<<<<<
 *     cdef bamReadBuffer theBuffer
 * 
 */
  if (unlikely(__pyx_v_readBuffers == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 771, __pyx_L1_error)
  }
  __pyx_t_3 = PyList_GET_SIZE(__pyx_v_readBuffers); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 771, __pyx_L1_error)
  __pyx_v_nIndividuals = __pyx_t_3;

  /* "variantcaller.pyx":774
 *     cdef bamReadBuffer theBuffer
 * 
 *     cdef int minCov = -1             # <<<<<<<<<<<<<<
 *     cdef int theStart = 0
 *     cdef int granularity = 1
 */
  __pyx_v_minCov = -1;

  /* "variantcaller.pyx":775
 * 
 *     cdef int minCov = -1
 *     cdef int theStart = 0             # <<<<<<<<<<<<<<
 *     cdef int granularity = 1
 * 
 */
  __pyx_v_theStart = 0;

  /* "variantcaller.pyx":776
 *     cdef int minCov = -1
 *     cdef int theStart = 0
 *     cdef int granularity = 1             # <<<<<<<<<<<<<<
 * 
 *     for index,theBuffer in enumerate(readBuffers):
 */
  __pyx_v_granularity = 1;

  /* "variantcaller.pyx":778
 *     cdef int granularity = 1
 * 
 *     for index,theBuffer in enumerate(readBuffers):             # <<<<<<<<<<<<<<
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):
 */
  __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_v_readBuffers; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 778, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_v_index = __pyx_t_3;
    __pyx_t_3 = (__pyx_t_3 + 1);

    /* "variantcaller.pyx":780
 *     for index,theBuffer in enumerate(readBuffers):
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):             # <<<<<<<<<<<<<<
 *             if minCov == -1:
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)
 */
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_granularity); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
      __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 780, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 780, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 780, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 780, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 780, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_10(__pyx_t_8);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 780, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_theStart = __pyx_t_2;

      /* "variantcaller.pyx":781
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):
 *             if minCov == -1:             # <<<<<<<<<<<<<<
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)
 *             else:
 */
      __pyx_t_11 = ((__pyx_v_minCov == -1L) != 0);
      if (__pyx_t_11) {

        /* "variantcaller.pyx":782
 *         for theStart in range(windowStart, windowEnd, granularity):
 *             if minCov == -1:
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)             # <<<<<<<<<<<<<<
 *             else:
 *                 minCov = min(minCov, theBuffer.countReadsCoveringRegion(theStart, theStart+1))
 */
        __pyx_v_minCov = ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theBuffer->__pyx_vtab)->countReadsCoveringRegion(__pyx_v_theBuffer, __pyx_v_theStart, (__pyx_v_theStart + 1));

        /* "variantcaller.pyx":781
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):
 *             if minCov == -1:             # <<<<<<<<<<<<<<
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)
 *             else:
 */
        goto __pyx_L7;
      }

      /* "variantcaller.pyx":784
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)
 *             else:
 *                 minCov = min(minCov, theBuffer.countReadsCoveringRegion(theStart, theStart+1))             # <<<<<<<<<<<<<<
 * 
 *     # What should the qual value be for this?
 */
      /*else*/ {
        __pyx_t_2 = ((struct __pyx_vtabstruct_7cwindow_bamReadBuffer *)__pyx_v_theBuffer->__pyx_vtab)->countReadsCoveringRegion(__pyx_v_theBuffer, __pyx_v_theStart, (__pyx_v_theStart + 1));
        __pyx_t_12 = __pyx_v_minCov;
        if (((__pyx_t_2 < __pyx_t_12) != 0)) {
          __pyx_t_13 = __pyx_t_2;
        } else {
          __pyx_t_13 = __pyx_t_12;
        }
        __pyx_v_minCov = __pyx_t_13;
      }
      __pyx_L7:;

      /* "variantcaller.pyx":780
 *     for index,theBuffer in enumerate(readBuffers):
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):             # <<<<<<<<<<<<<<
 *             if minCov == -1:
 *                 minCov = theBuffer.countReadsCoveringRegion(theStart, theStart+1)
 */
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "variantcaller.pyx":778
 *     cdef int granularity = 1
 * 
 *     for index,theBuffer in enumerate(readBuffers):             # <<<<<<<<<<<<<<
 * 
 *         for theStart in range(windowStart, windowEnd, granularity):
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":795
 *     #    candidate. Try qual == phred( min( (1.0 - max(varPosteriors), sum(mapQuals)/sizeof(window) ) ) )
 * 
 *     cdef int phredPValue = int(-10*log10(betaBinomialCDF(0, minCov, 20, 20)))             # <<<<<<<<<<<<<<
 * 
 *     if minCov == 0:
 */
  __pyx_v_phredPValue = ((int)(-10.0 * log10(__pyx_f_13platypusutils_betaBinomialCDF(0, __pyx_v_minCov, 20, 20))));

  /* "variantcaller.pyx":797
 *     cdef int phredPValue = int(-10*log10(betaBinomialCDF(0, minCov, 20, 20)))
 * 
 *     if minCov == 0:             # <<<<<<<<<<<<<<
 *         qual = 0
 *     else:
 */
  __pyx_t_11 = ((__pyx_v_minCov == 0) != 0);
  if (__pyx_t_11) {

    /* "variantcaller.pyx":798
 * 
 *     if minCov == 0:
 *         qual = 0             # <<<<<<<<<<<<<<
 *     else:
 *         if len(variants) == 0:
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_qual = __pyx_int_0;

    /* "variantcaller.pyx":797
 *     cdef int phredPValue = int(-10*log10(betaBinomialCDF(0, minCov, 20, 20)))
 * 
 *     if minCov == 0:             # <<<<<<<<<<<<<<
 *         qual = 0
 *     else:
 */
    goto __pyx_L8;
  }

  /* "variantcaller.pyx":800
 *         qual = 0
 *     else:
 *         if len(variants) == 0:             # <<<<<<<<<<<<<<
 *             qual = phredPValue
 *         else:
 */
  /*else*/ {
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 800, __pyx_L1_error)
    }
    __pyx_t_3 = PyList_GET_SIZE(__pyx_v_variants); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 800, __pyx_L1_error)
    __pyx_t_11 = ((__pyx_t_3 == 0) != 0);
    if (__pyx_t_11) {

      /* "variantcaller.pyx":801
 *     else:
 *         if len(variants) == 0:
 *             qual = phredPValue             # <<<<<<<<<<<<<<
 *         else:
 *             maxPost = max( [pop.calculatePosterior(v, 1) for v in variants] )
 */
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_phredPValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_qual = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "variantcaller.pyx":800
 *         qual = 0
 *     else:
 *         if len(variants) == 0:             # <<<<<<<<<<<<<<
 *             qual = phredPValue
 *         else:
 */
      goto __pyx_L9;
    }

    /* "variantcaller.pyx":803
 *             qual = phredPValue
 *         else:
 *             maxPost = max( [pop.calculatePosterior(v, 1) for v in variants] )             # <<<<<<<<<<<<<<
 *             maxProbVar = 1.0 - 10**(-0.1*maxPost)
 *             probRef = 1.0 - maxProbVar
 */
    /*else*/ {
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__pyx_v_variants == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 803, __pyx_L1_error)
      }
      __pyx_t_8 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_8); __pyx_t_3 = 0;
      for (;;) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_3); __Pyx_INCREF(__pyx_t_7); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 803, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 803, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
        __pyx_t_7 = 0;
        if (!(likely(((__pyx_v_v) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_v, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 803, __pyx_L1_error)
        __pyx_t_15.__pyx_n = 1;
        __pyx_t_15.flatPrior = 1;
        __pyx_t_14 = ((struct __pyx_vtabstruct_11cpopulation_Population *)__pyx_v_pop->__pyx_vtab)->calculatePosterior(__pyx_v_pop, ((struct __pyx_obj_7variant_Variant *)__pyx_v_v), &__pyx_t_15); 
        __pyx_t_7 = PyFloat_FromDouble(__pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 803, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 803, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_maxPost = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":804
 *         else:
 *             maxPost = max( [pop.calculatePosterior(v, 1) for v in variants] )
 *             maxProbVar = 1.0 - 10**(-0.1*maxPost)             # <<<<<<<<<<<<<<
 *             probRef = 1.0 - maxProbVar
 *             qual = min(int(round(-10.0 * log10(1.0-probRef))), phredPValue)
 */
      __pyx_t_8 = PyNumber_Multiply(__pyx_float_neg_0_1, __pyx_v_maxPost); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyNumber_Power(__pyx_int_10, __pyx_t_8, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_t_1, 1.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_maxProbVar = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":805
 *             maxPost = max( [pop.calculatePosterior(v, 1) for v in variants] )
 *             maxProbVar = 1.0 - 10**(-0.1*maxPost)
 *             probRef = 1.0 - maxProbVar             # <<<<<<<<<<<<<<
 *             qual = min(int(round(-10.0 * log10(1.0-probRef))), phredPValue)
 * 
 */
      __pyx_t_8 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_v_maxProbVar, 1.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_v_probRef = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "variantcaller.pyx":806
 *             maxProbVar = 1.0 - 10**(-0.1*maxPost)
 *             probRef = 1.0 - maxProbVar
 *             qual = min(int(round(-10.0 * log10(1.0-probRef))), phredPValue)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_13 = __pyx_v_phredPValue;
      __pyx_t_8 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_v_probRef, 1.0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_FromDouble(round((-10.0 * log10(__pyx_t_14)))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_11) {
        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_1 = __pyx_t_8;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_qual = __pyx_t_8;
      __pyx_t_8 = 0;
    }
    __pyx_L9:;
  }
  __pyx_L8:;

  /* "variantcaller.pyx":810
 * 
 *     # Sort out VCF output
 *     ref = refFile.getSequence(chrom, windowStart, windowStart+1)             # <<<<<<<<<<<<<<
 *     alt = None
 * 
 */
  __pyx_t_8 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_windowStart, (__pyx_v_windowStart + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_ref = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "variantcaller.pyx":811
 *     # Sort out VCF output
 *     ref = refFile.getSequence(chrom, windowStart, windowStart+1)
 *     alt = None             # <<<<<<<<<<<<<<
 * 
 *     # Kludge. To keep within the VCF standard, REF and ALT must be different. At least one of
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_alt = ((PyObject*)Py_None);

  /* "variantcaller.pyx":815
 *     # Kludge. To keep within the VCF standard, REF and ALT must be different. At least one of
 *     # the fields will always be 'N', which should help to avoid confusion with normal variant calls
 *     if ref == "N":             # <<<<<<<<<<<<<<
 *         alt = ["T"]
 *     else:
 */
  __pyx_t_11 = (__Pyx_PyBytes_Equals(__pyx_v_ref, __pyx_n_s_N, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_t_16 = (__pyx_t_11 != 0);
  if (__pyx_t_16) {

    /* "variantcaller.pyx":816
 *     # the fields will always be 'N', which should help to avoid confusion with normal variant calls
 *     if ref == "N":
 *         alt = ["T"]             # <<<<<<<<<<<<<<
 *     else:
 *         alt = ["N"]
 */
    __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_n_s_T);
    __Pyx_GIVEREF(__pyx_n_s_T);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_T);
    __Pyx_DECREF_SET(__pyx_v_alt, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "variantcaller.pyx":815
 *     # Kludge. To keep within the VCF standard, REF and ALT must be different. At least one of
 *     # the fields will always be 'N', which should help to avoid confusion with normal variant calls
 *     if ref == "N":             # <<<<<<<<<<<<<<
 *         alt = ["T"]
 *     else:
 */
    goto __pyx_L12;
  }

  /* "variantcaller.pyx":818
 *         alt = ["T"]
 *     else:
 *         alt = ["N"]             # <<<<<<<<<<<<<<
 * 
 *     id = "."
 */
  /*else*/ {
    __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_n_s_N);
    __Pyx_GIVEREF(__pyx_n_s_N);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_N);
    __Pyx_DECREF_SET(__pyx_v_alt, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;
  }
  __pyx_L12:;

  /* "variantcaller.pyx":820
 *         alt = ["N"]
 * 
 *     id = "."             # <<<<<<<<<<<<<<
 *     linefilter = ["REFCALL"]
 *     lineinfo = {}
 */
  __Pyx_INCREF(__pyx_kp_s__2);
  __pyx_v_id = __pyx_kp_s__2;

  /* "variantcaller.pyx":821
 * 
 *     id = "."
 *     linefilter = ["REFCALL"]             # <<<<<<<<<<<<<<
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_n_s_REFCALL);
  __Pyx_GIVEREF(__pyx_n_s_REFCALL);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_REFCALL);
  __pyx_v_linefilter = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "variantcaller.pyx":822
 *     id = "."
 *     linefilter = ["REFCALL"]
 *     lineinfo = {}             # <<<<<<<<<<<<<<
 *     lineinfo['END'] = [windowEnd]
 *     lineinfo['Size'] = [windowSize]
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_lineinfo = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "variantcaller.pyx":823
 *     linefilter = ["REFCALL"]
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]             # <<<<<<<<<<<<<<
 *     lineinfo['Size'] = [windowSize]
 * 
 */
  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __pyx_t_8 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_END, __pyx_t_1) < 0)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":824
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]
 *     lineinfo['Size'] = [windowSize]             # <<<<<<<<<<<<<<
 * 
 *     # I'll fill in some of these later.
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowSize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_Size_2, __pyx_t_8) < 0)) __PYX_ERR(0, 824, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":827
 * 
 *     # I'll fill in some of these later.
 *     lineinfo['FR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_FR, __pyx_t_8) < 0)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":828
 *     # I'll fill in some of these later.
 *     lineinfo['FR'] = ["."]
 *     lineinfo['MMLQ'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_MMLQ, __pyx_t_8) < 0)) __PYX_ERR(0, 828, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":829
 *     lineinfo['FR'] = ["."]
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_HP, __pyx_t_8) < 0)) __PYX_ERR(0, 829, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":830
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_TCR, __pyx_t_8) < 0)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":831
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_WE_2, __pyx_t_8) < 0)) __PYX_ERR(0, 831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":832
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_WS_2, __pyx_t_8) < 0)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":833
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_Source, __pyx_t_8) < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":834
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_FS, __pyx_t_8) < 0)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":835
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_START, __pyx_t_8) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":836
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_PP, __pyx_t_8) < 0)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":837
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_TR, __pyx_t_8) < 0)) __PYX_ERR(0, 837, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":838
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_NF, __pyx_t_8) < 0)) __PYX_ERR(0, 838, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":839
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_TCF, __pyx_t_8) < 0)) __PYX_ERR(0, 839, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":840
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_NR, __pyx_t_8) < 0)) __PYX_ERR(0, 840, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":841
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_TC, __pyx_t_8) < 0)) __PYX_ERR(0, 841, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":842
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_MGOF, __pyx_t_8) < 0)) __PYX_ERR(0, 842, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":843
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_SbPval, __pyx_t_8) < 0)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":844
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_ReadPosRankSum, __pyx_t_8) < 0)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":845
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_MQ, __pyx_t_8) < 0)) __PYX_ERR(0, 845, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":846
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_QD, __pyx_t_8) < 0)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":847
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['BRF'] = ["."]
 *     lineinfo['HapScore'] = ["."]
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_SC, __pyx_t_8) < 0)) __PYX_ERR(0, 847, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":848
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['HapScore'] = ["."]
 * 
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_BRF, __pyx_t_8) < 0)) __PYX_ERR(0, 848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":849
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]
 *     lineinfo['HapScore'] = ["."]             # <<<<<<<<<<<<<<
 * 
 *     # Most of these are empty
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s__2);
  __Pyx_GIVEREF(__pyx_kp_s__2);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s__2);
  if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_HapScore, __pyx_t_8) < 0)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":852
 * 
 *     # Most of these are empty
 *     theFormat = ['GT:GL:GOF:GQ:NR:NV']             # <<<<<<<<<<<<<<
 * 
 *     vcfDataLine = {'chrom':chrom,'pos':windowStart,'ref':ref,'alt':alt,'id':id,'info':lineinfo,'filter':linefilter,'qual':qual,'format':theFormat}
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
  __Pyx_GIVEREF(__pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
  __pyx_v_theFormat = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "variantcaller.pyx":854
 *     theFormat = ['GT:GL:GOF:GQ:NR:NV']
 * 
 *     vcfDataLine = {'chrom':chrom,'pos':windowStart,'ref':ref,'alt':alt,'id':id,'info':lineinfo,'filter':linefilter,'qual':qual,'format':theFormat}             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < nIndividuals:
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_pos, __pyx_t_1) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_alt, __pyx_v_alt) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_id, __pyx_v_id) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_info, __pyx_v_lineinfo) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_filter, __pyx_v_linefilter) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_qual, __pyx_v_qual) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_format, __pyx_v_theFormat) < 0) __PYX_ERR(0, 854, __pyx_L1_error)
  __pyx_v_vcfDataLine = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "variantcaller.pyx":856
 *     vcfDataLine = {'chrom':chrom,'pos':windowStart,'ref':ref,'alt':alt,'id':id,'info':lineinfo,'filter':linefilter,'qual':qual,'format':theFormat}
 * 
 *     for i from 0 <= i < nIndividuals:             # <<<<<<<<<<<<<<
 * 
 *         theBuffer = readBuffers[i]
 */
  __pyx_t_13 = __pyx_v_nIndividuals;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_13; __pyx_v_i++) {

    /* "variantcaller.pyx":858
 *     for i from 0 <= i < nIndividuals:
 * 
 *         theBuffer = readBuffers[i]             # <<<<<<<<<<<<<<
 *         thisSample = theBuffer.sample
 * 
 */
    if (unlikely(__pyx_v_readBuffers == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 858, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 858, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 858, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "variantcaller.pyx":859
 * 
 *         theBuffer = readBuffers[i]
 *         thisSample = theBuffer.sample             # <<<<<<<<<<<<<<
 * 
 *         # Missing genotype call. Probably due to zero coverage for this individual.
 */
    __pyx_t_8 = __pyx_v_theBuffer->sample;
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_XDECREF_SET(__pyx_v_thisSample, ((PyObject*)__pyx_t_8));
    __pyx_t_8 = 0;

    /* "variantcaller.pyx":862
 * 
 *         # Missing genotype call. Probably due to zero coverage for this individual.
 *         if theBuffer.reads.windowEnd - theBuffer.reads.windowStart == 0:             # <<<<<<<<<<<<<<
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[0], NV=[0])
 *         else:
 */
    __pyx_t_16 = (((__pyx_v_theBuffer->reads->windowEnd - __pyx_v_theBuffer->reads->windowStart) == 0) != 0);
    if (__pyx_t_16) {

      /* "variantcaller.pyx":863
 *         # Missing genotype call. Probably due to zero coverage for this individual.
 *         if theBuffer.reads.windowEnd - theBuffer.reads.windowStart == 0:
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[0], NV=[0])             # <<<<<<<<<<<<<<
 *         else:
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[theBuffer.reads.windowEnd - theBuffer.reads.windowStart], NV=[0])
 */
      __pyx_t_8 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s__2);
      __Pyx_INCREF(__pyx_kp_s__4);
      __Pyx_GIVEREF(__pyx_kp_s__4);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_s__4);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_kp_s__2);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GT, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 2, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GL, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GQ, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GOF, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_NR, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_NV, __pyx_t_6) < 0) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_vcfDataLine, __pyx_v_thisSample, __pyx_t_8) < 0)) __PYX_ERR(0, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "variantcaller.pyx":862
 * 
 *         # Missing genotype call. Probably due to zero coverage for this individual.
 *         if theBuffer.reads.windowEnd - theBuffer.reads.windowStart == 0:             # <<<<<<<<<<<<<<
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[0], NV=[0])
 *         else:
 */
      goto __pyx_L15;
    }

    /* "variantcaller.pyx":865
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[0], NV=[0])
 *         else:
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[theBuffer.reads.windowEnd - theBuffer.reads.windowStart], NV=[0])             # <<<<<<<<<<<<<<
 * 
 *     vcfFile.write_data(outputFile, vcfDataLine)
 */
    /*else*/ {
      __pyx_t_8 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s__2);
      __Pyx_INCREF(__pyx_kp_s__4);
      __Pyx_GIVEREF(__pyx_kp_s__4);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_kp_s__4);
      __Pyx_INCREF(__pyx_kp_s__2);
      __Pyx_GIVEREF(__pyx_kp_s__2);
      PyList_SET_ITEM(__pyx_t_6, 2, __pyx_kp_s__2);
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GT, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GL, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GQ, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_GOF, __pyx_t_1) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_theBuffer->reads->windowEnd - __pyx_v_theBuffer->reads->windowStart)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_NR, __pyx_t_6) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_NV, __pyx_t_6) < 0) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_vcfDataLine, __pyx_v_thisSample, __pyx_t_8) < 0)) __PYX_ERR(0, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L15:;
  }

  /* "variantcaller.pyx":867
 *             vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[-1,-1,-1], GQ=[-1],GOF=[-1],NR=[theBuffer.reads.windowEnd - theBuffer.reads.windowStart], NV=[0])
 * 
 *     vcfFile.write_data(outputFile, vcfDataLine)             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_vcfFile, __pyx_n_s_write_data); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = NULL;
  __pyx_t_13 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_13 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_outputFile, __pyx_v_vcfDataLine};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_outputFile, __pyx_v_vcfDataLine};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_outputFile);
    __Pyx_GIVEREF(__pyx_v_outputFile);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_13, __pyx_v_outputFile);
    __Pyx_INCREF(__pyx_v_vcfDataLine);
    __Pyx_GIVEREF(__pyx_v_vcfDataLine);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_13, __pyx_v_vcfDataLine);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":764
 * ###################################################################################################
 * 
 * def outputRefCall(bytes chrom, Population pop, vcfFile, FastaFile refFile, outputFile, int windowIndex, dict window, options, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

  /* function exit code */
  __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_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("variantcaller.outputRefCall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_variants);
  __Pyx_XDECREF((PyObject *)__pyx_v_theBuffer);
  __Pyx_XDECREF(__pyx_v_qual);
  __Pyx_XDECREF(__pyx_v_maxPost);
  __Pyx_XDECREF(__pyx_v_maxProbVar);
  __Pyx_XDECREF(__pyx_v_probRef);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_alt);
  __Pyx_XDECREF(__pyx_v_id);
  __Pyx_XDECREF(__pyx_v_linefilter);
  __Pyx_XDECREF(__pyx_v_lineinfo);
  __Pyx_XDECREF(__pyx_v_theFormat);
  __Pyx_XDECREF(__pyx_v_vcfDataLine);
  __Pyx_XDECREF(__pyx_v_thisSample);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":880
 *     bamFiles = None
 * 
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_21PlatypusSingleProcess_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_13variantcaller_21PlatypusSingleProcess___init__[] = "\n        Constructor. Store options and output file name\n        ";
static PyMethodDef __pyx_mdef_13variantcaller_21PlatypusSingleProcess_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_13variantcaller_21PlatypusSingleProcess_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_13variantcaller_21PlatypusSingleProcess___init__};
static PyObject *__pyx_pw_13variantcaller_21PlatypusSingleProcess_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fileName = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_v_regions = 0;
  PyObject *__pyx_v_continuing = 0;
  CYTHON_UNUSED PyObject *__pyx_v_samples = 0;
  CYTHON_UNUSED PyObject *__pyx_v_bamFileNames = 0;
  CYTHON_UNUSED PyObject *__pyx_v_samplesByID = 0;
  CYTHON_UNUSED PyObject *__pyx_v_samplesByBAM = 0;
  PyObject *__pyx_v_bamFiles = 0;
  PyObject *__pyx_v_theLocks = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fileName,&__pyx_n_s_options,&__pyx_n_s_regions,&__pyx_n_s_continuing,&__pyx_n_s_samples,&__pyx_n_s_bamFileNames,&__pyx_n_s_samplesByID,&__pyx_n_s_samplesByBAM,&__pyx_n_s_bamFiles,&__pyx_n_s_theLocks,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    values[7] = ((PyObject *)((PyObject *)Py_None));
    values[8] = ((PyObject *)((PyObject *)Py_None));
    values[9] = ((PyObject *)((PyObject *)Py_None));
    values[10] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fileName)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 1); __PYX_ERR(0, 880, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 2); __PYX_ERR(0, 880, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_regions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 3); __PYX_ERR(0, 880, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_continuing);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samples);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bamFileNames);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplesByID);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplesByBAM);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bamFiles);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theLocks);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 880, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  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_self = values[0];
    __pyx_v_fileName = values[1];
    __pyx_v_options = values[2];
    __pyx_v_regions = values[3];
    __pyx_v_continuing = values[4];
    __pyx_v_samples = values[5];
    __pyx_v_bamFileNames = values[6];
    __pyx_v_samplesByID = values[7];
    __pyx_v_samplesByBAM = values[8];
    __pyx_v_bamFiles = values[9];
    __pyx_v_theLocks = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 880, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("variantcaller.PlatypusSingleProcess.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_13variantcaller_21PlatypusSingleProcess___init__(__pyx_self, __pyx_v_self, __pyx_v_fileName, __pyx_v_options, __pyx_v_regions, __pyx_v_continuing, __pyx_v_samples, __pyx_v_bamFileNames, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_bamFiles, __pyx_v_theLocks);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_21PlatypusSingleProcess___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fileName, PyObject *__pyx_v_options, PyObject *__pyx_v_regions, PyObject *__pyx_v_continuing, CYTHON_UNUSED PyObject *__pyx_v_samples, CYTHON_UNUSED PyObject *__pyx_v_bamFileNames, CYTHON_UNUSED PyObject *__pyx_v_samplesByID, CYTHON_UNUSED PyObject *__pyx_v_samplesByBAM, PyObject *__pyx_v_bamFiles, PyObject *__pyx_v_theLocks) {
  struct __pyx_obj_13htslibWrapper_Samfile *__pyx_v_theBamFile = 0;
  PyObject *__pyx_v_theLock = NULL;
  PyObject *__pyx_v_isBamOrCram = 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;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  long __pyx_t_14;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "variantcaller.pyx":884
 *         Constructor. Store options and output file name
 *         """
 *         self.options = options             # <<<<<<<<<<<<<<
 *         self.fileName = fileName
 *         self.regions = regions
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_options, __pyx_v_options) < 0) __PYX_ERR(0, 884, __pyx_L1_error)

  /* "variantcaller.pyx":885
 *         """
 *         self.options = options
 *         self.fileName = fileName             # <<<<<<<<<<<<<<
 *         self.regions = regions
 *         self.continuing = continuing
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fileName, __pyx_v_fileName) < 0) __PYX_ERR(0, 885, __pyx_L1_error)

  /* "variantcaller.pyx":886
 *         self.options = options
 *         self.fileName = fileName
 *         self.regions = regions             # <<<<<<<<<<<<<<
 *         self.continuing = continuing
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_regions, __pyx_v_regions) < 0) __PYX_ERR(0, 886, __pyx_L1_error)

  /* "variantcaller.pyx":887
 *         self.fileName = fileName
 *         self.regions = regions
 *         self.continuing = continuing             # <<<<<<<<<<<<<<
 * 
 *         cdef Samfile theBamFile
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_continuing, __pyx_v_continuing) < 0) __PYX_ERR(0, 887, __pyx_L1_error)

  /* "variantcaller.pyx":891
 *         cdef Samfile theBamFile
 * 
 *         if bamFiles is not None and theLocks is not None:             # <<<<<<<<<<<<<<
 *             for theBamFile,theLock in zip(bamFiles,theLocks):
 *                 theBamFile.lock = theLock
 */
  __pyx_t_2 = (__pyx_v_bamFiles != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_theLocks != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "variantcaller.pyx":892
 * 
 *         if bamFiles is not None and theLocks is not None:
 *             for theBamFile,theLock in zip(bamFiles,theLocks):             # <<<<<<<<<<<<<<
 *                 theBamFile.lock = theLock
 * 
 */
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_bamFiles);
    __Pyx_GIVEREF(__pyx_v_bamFiles);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bamFiles);
    __Pyx_INCREF(__pyx_v_theLocks);
    __Pyx_GIVEREF(__pyx_v_theLocks);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_theLocks);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 892, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 892, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 892, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 892, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 892, __pyx_L1_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 892, __pyx_L1_error)
        __pyx_L9_unpacking_done:;
      }
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_13htslibWrapper_Samfile))))) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_theBamFile, ((struct __pyx_obj_13htslibWrapper_Samfile *)__pyx_t_8));
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_theLock, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "variantcaller.pyx":893
 *         if bamFiles is not None and theLocks is not None:
 *             for theBamFile,theLock in zip(bamFiles,theLocks):
 *                 theBamFile.lock = theLock             # <<<<<<<<<<<<<<
 * 
 *         if self.options.verbosity >= 3:
 */
      __Pyx_INCREF(__pyx_v_theLock);
      __Pyx_GIVEREF(__pyx_v_theLock);
      __Pyx_GOTREF(__pyx_v_theBamFile->lock);
      __Pyx_DECREF(__pyx_v_theBamFile->lock);
      __pyx_v_theBamFile->lock = __pyx_v_theLock;

      /* "variantcaller.pyx":892
 * 
 *         if bamFiles is not None and theLocks is not None:
 *             for theBamFile,theLock in zip(bamFiles,theLocks):             # <<<<<<<<<<<<<<
 *                 theBamFile.lock = theLock
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":891
 *         cdef Samfile theBamFile
 * 
 *         if bamFiles is not None and theLocks is not None:             # <<<<<<<<<<<<<<
 *             for theBamFile,theLock in zip(bamFiles,theLocks):
 *                 theBamFile.lock = theLock
 */
  }

  /* "variantcaller.pyx":895
 *                 theBamFile.lock = theLock
 * 
 *         if self.options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.info("Searching for variants in the following regions: %s" %(self.regions))
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "variantcaller.pyx":896
 * 
 *         if self.options.verbosity >= 3:
 *             logger.info("Searching for variants in the following regions: %s" %(self.regions))             # <<<<<<<<<<<<<<
 * 
 *         # Need to load data etc.
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_regions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Searching_for_variants_in_the_fo, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":895
 *                 theBamFile.lock = theLock
 * 
 *         if self.options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.info("Searching for variants in the following regions: %s" %(self.regions))
 * 
 */
  }

  /* "variantcaller.pyx":899
 * 
 *         # Need to load data etc.
 *         self.bamFileNames = options.bamFiles             # <<<<<<<<<<<<<<
 * 
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_bamFiles); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames, __pyx_t_4) < 0) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":901
 *         self.bamFileNames = options.bamFiles
 * 
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))             # <<<<<<<<<<<<<<
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_lower); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_9 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_endswith); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_tuple__5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_tuple__5);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_v_isBamOrCram = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":903
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:             # <<<<<<<<<<<<<<
 *             logger.debug("Treating --bamFiles argument, %s as a text file containing a list of BAM file names" %(self.bamFileNames))
 *             self.bamFileNames = platypusutils.getBAMFileNamesFromTextFile(self.bamFileNames[0])
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = ((__pyx_t_6 == 1) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isBamOrCram); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 903, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_1) {

    /* "variantcaller.pyx":904
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:
 *             logger.debug("Treating --bamFiles argument, %s as a text file containing a list of BAM file names" %(self.bamFileNames))             # <<<<<<<<<<<<<<
 *             self.bamFileNames = platypusutils.getBAMFileNamesFromTextFile(self.bamFileNames[0])
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_logger); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Treating_bamFiles_argument_s_as, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":905
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:
 *             logger.debug("Treating --bamFiles argument, %s as a text file containing a list of BAM file names" %(self.bamFileNames))
 *             self.bamFileNames = platypusutils.getBAMFileNamesFromTextFile(self.bamFileNames[0])             # <<<<<<<<<<<<<<
 * 
 *         self.samples,self.samplesByID,self.samplesByBAM,self.bamFiles = platypusutils.getSampleNamesAndLoadIterators(self.bamFileNames, self.regions, options)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_platypusutils); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_getBAMFileNamesFromTextFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames, __pyx_t_4) < 0) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":903
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:             # <<<<<<<<<<<<<<
 *             logger.debug("Treating --bamFiles argument, %s as a text file containing a list of BAM file names" %(self.bamFileNames))
 *             self.bamFileNames = platypusutils.getBAMFileNamesFromTextFile(self.bamFileNames[0])
 */
  }

  /* "variantcaller.pyx":907
 *             self.bamFileNames = platypusutils.getBAMFileNamesFromTextFile(self.bamFileNames[0])
 * 
 *         self.samples,self.samplesByID,self.samplesByBAM,self.bamFiles = platypusutils.getSampleNamesAndLoadIterators(self.bamFileNames, self.regions, options)             # <<<<<<<<<<<<<<
 * 
 *         if options.refFile.endswith(".gz") or options.refFile.endswith(".bz2") or options.refFile.endswith(".bgz"):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_platypusutils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_getSampleNamesAndLoadIterators); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFileNames); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_regions); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_5, __pyx_t_9, __pyx_v_options};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 907, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_5, __pyx_t_9, __pyx_v_options};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 907, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_9);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_v_options);
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 907, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_13,&__pyx_t_9,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 907, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_13,&__pyx_t_9,&__pyx_t_5};
    __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L14_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 4) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L15_unpacking_done;
    __pyx_L14_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 907, __pyx_L1_error)
    __pyx_L15_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_samples, __pyx_t_8) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_samplesByID, __pyx_t_13) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_samplesByBAM, __pyx_t_9) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bamFiles, __pyx_t_5) < 0) __PYX_ERR(0, 907, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":909
 *         self.samples,self.samplesByID,self.samplesByBAM,self.bamFiles = platypusutils.getSampleNamesAndLoadIterators(self.bamFileNames, self.regions, options)
 * 
 *         if options.refFile.endswith(".gz") or options.refFile.endswith(".bz2") or options.refFile.endswith(".bgz"):             # <<<<<<<<<<<<<<
 *             logger.error("Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus" %(options.refFile))
 *             raise StandardError, "Invalid reference FASTA file supplied"
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_endswith); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_kp_s_gz) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_s_gz);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_kp_s_bz2) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_bz2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_endswith); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_5, __pyx_kp_s_bgz) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_s_bgz);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L17_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "variantcaller.pyx":910
 * 
 *         if options.refFile.endswith(".gz") or options.refFile.endswith(".bz2") or options.refFile.endswith(".bgz"):
 *             logger.error("Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus" %(options.refFile))             # <<<<<<<<<<<<<<
 *             raise StandardError, "Invalid reference FASTA file supplied"
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Reference_file_name_s_looks_like, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 910, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 910, __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;

    /* "variantcaller.pyx":911
 *         if options.refFile.endswith(".gz") or options.refFile.endswith(".bz2") or options.refFile.endswith(".bgz"):
 *             logger.error("Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus" %(options.refFile))
 *             raise StandardError, "Invalid reference FASTA file supplied"             # <<<<<<<<<<<<<<
 * 
 *         self.refFile = fastafile.FastaFile(options.refFile, options.refFile + ".fai")
 */
    __Pyx_Raise(__pyx_builtin_StandardError, __pyx_kp_s_Invalid_reference_FASTA_file_sup, 0, 0);
    __PYX_ERR(0, 911, __pyx_L1_error)

    /* "variantcaller.pyx":909
 *         self.samples,self.samplesByID,self.samplesByBAM,self.bamFiles = platypusutils.getSampleNamesAndLoadIterators(self.bamFileNames, self.regions, options)
 * 
 *         if options.refFile.endswith(".gz") or options.refFile.endswith(".bz2") or options.refFile.endswith(".bgz"):             # <<<<<<<<<<<<<<
 *             logger.error("Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus" %(options.refFile))
 *             raise StandardError, "Invalid reference FASTA file supplied"
 */
  }

  /* "variantcaller.pyx":913
 *             raise StandardError, "Invalid reference FASTA file supplied"
 * 
 *         self.refFile = fastafile.FastaFile(options.refFile, options.refFile + ".fai")             # <<<<<<<<<<<<<<
 * 
 *         # Set these to sensible values, based on population size
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_refFile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = PyNumber_Add(__pyx_t_5, __pyx_kp_s_fai); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_13);
  __pyx_t_4 = 0;
  __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9fastafile_FastaFile), __pyx_t_5, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_refFile, __pyx_t_13) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "variantcaller.pyx":916
 * 
 *         # Set these to sensible values, based on population size
 *         if self.options.maxHaplotypes == -1:             # <<<<<<<<<<<<<<
 *             self.options.maxHaplotypes = 257
 * 
 */
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__pyx_t_1) {

    /* "variantcaller.pyx":917
 *         # Set these to sensible values, based on population size
 *         if self.options.maxHaplotypes == -1:
 *             self.options.maxHaplotypes = 257             # <<<<<<<<<<<<<<
 * 
 *         # maxHaplotypes has to be capped
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 917, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_13, __pyx_n_s_maxHaplotypes, __pyx_int_257) < 0) __PYX_ERR(0, 917, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "variantcaller.pyx":916
 * 
 *         # Set these to sensible values, based on population size
 *         if self.options.maxHaplotypes == -1:             # <<<<<<<<<<<<<<
 *             self.options.maxHaplotypes = 257
 * 
 */
  }

  /* "variantcaller.pyx":920
 * 
 *         # maxHaplotypes has to be capped
 *         self.options.originalMaxHaplotypes = self.options.maxHaplotypes             # <<<<<<<<<<<<<<
 *         self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))
 */
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_13, __pyx_n_s_originalMaxHaplotypes, __pyx_t_5) < 0) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "variantcaller.pyx":921
 *         # maxHaplotypes has to be capped
 *         self.options.originalMaxHaplotypes = self.options.maxHaplotypes
 *         self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)             # <<<<<<<<<<<<<<
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))
 *         if self.options.HLATyping ==0:
 */
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_14 = 0x101;
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_13 = __pyx_t_5;
  } else {
    __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_13 = __pyx_t_9;
    __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_13;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_13, __pyx_n_s_maxHaplotypes, __pyx_t_5) < 0) __PYX_ERR(0, 921, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

  /* "variantcaller.pyx":922
 *         self.options.originalMaxHaplotypes = self.options.maxHaplotypes
 *         self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))             # <<<<<<<<<<<<<<
 *         if self.options.HLATyping ==0:
 *             self.options.maxGenotypes = platypusutils.nCombinationsWithReplacement(self.options.originalMaxHaplotypes, 2)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_platypusutils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_nCombinationsWithReplacement); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_12 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_12 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_int_2};
    __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_int_2};
    __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_12, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_12, __pyx_int_2);
    __pyx_t_4 = 0;
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_14 = 0x8181;
  __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_13, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_9 = __pyx_t_13;
  } else {
    __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __pyx_t_9;
  __Pyx_INCREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_9, __pyx_n_s_maxGenotypes, __pyx_t_13) < 0) __PYX_ERR(0, 922, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "variantcaller.pyx":923
 *         self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))
 *         if self.options.HLATyping ==0:             # <<<<<<<<<<<<<<
 *             self.options.maxGenotypes = platypusutils.nCombinationsWithReplacement(self.options.originalMaxHaplotypes, 2)
 * 
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_HLATyping); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_t_13, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_1) {

    /* "variantcaller.pyx":924
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))
 *         if self.options.HLATyping ==0:
 *             self.options.maxGenotypes = platypusutils.nCombinationsWithReplacement(self.options.originalMaxHaplotypes, 2)             # <<<<<<<<<<<<<<
 * 
 *         #self.options.maxGenotypes = 33153
 */
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_platypusutils); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_nCombinationsWithReplacement); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_originalMaxHaplotypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_8, __pyx_int_2};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_8, __pyx_int_2};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_13) {
        __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_13); __pyx_t_13 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_int_2);
      __pyx_t_8 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_4, __pyx_n_s_maxGenotypes, __pyx_t_9) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "variantcaller.pyx":923
 *         self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)
 *         self.options.maxGenotypes = min(33153, platypusutils.nCombinationsWithReplacement(self.options.maxHaplotypes, 2))
 *         if self.options.HLATyping ==0:             # <<<<<<<<<<<<<<
 *             self.options.maxGenotypes = platypusutils.nCombinationsWithReplacement(self.options.originalMaxHaplotypes, 2)
 * 
 */
  }

  /* "variantcaller.pyx":929
 *         #self.options.maxHaplotypes = min(257, self.options.maxHaplotypes)
 * 
 *         logger.debug("Max haplotypes used for initial haplotype filtering = %s" %(self.options.originalMaxHaplotypes))             # <<<<<<<<<<<<<<
 *         logger.debug("Max haplotypes used for genotype generation = %s" %(self.options.maxHaplotypes))
 *         logger.debug("Max genotypes = %s" %(self.options.maxGenotypes))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_originalMaxHaplotypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Max_haplotypes_used_for_initial, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __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;

  /* "variantcaller.pyx":930
 * 
 *         logger.debug("Max haplotypes used for initial haplotype filtering = %s" %(self.options.originalMaxHaplotypes))
 *         logger.debug("Max haplotypes used for genotype generation = %s" %(self.options.maxHaplotypes))             # <<<<<<<<<<<<<<
 *         logger.debug("Max genotypes = %s" %(self.options.maxGenotypes))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_maxHaplotypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Max_haplotypes_used_for_genotype, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":931
 *         logger.debug("Max haplotypes used for initial haplotype filtering = %s" %(self.options.originalMaxHaplotypes))
 *         logger.debug("Max haplotypes used for genotype generation = %s" %(self.options.maxHaplotypes))
 *         logger.debug("Max genotypes = %s" %(self.options.maxGenotypes))             # <<<<<<<<<<<<<<
 * 
 *         options.nInd = len(set(self.samples))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_logger); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_debug); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_maxGenotypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Max_genotypes_s, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 931, __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;

  /* "variantcaller.pyx":933
 *         logger.debug("Max genotypes = %s" %(self.options.maxGenotypes))
 * 
 *         options.nInd = len(set(self.samples))             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PySet_New(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = PySet_GET_SIZE(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s_nInd, __pyx_t_5) < 0) __PYX_ERR(0, 933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "variantcaller.pyx":880
 *     bamFiles = None
 * 
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */

  /* function exit code */
  __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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("variantcaller.PlatypusSingleProcess.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_theBamFile);
  __Pyx_XDECREF(__pyx_v_theLock);
  __Pyx_XDECREF(__pyx_v_isBamOrCram);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_21PlatypusSingleProcess_3run(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_13variantcaller_21PlatypusSingleProcess_2run[] = "\n        Run a single Platypus process\n        ";
static PyMethodDef __pyx_mdef_13variantcaller_21PlatypusSingleProcess_3run = {"run", (PyCFunction)__pyx_pw_13variantcaller_21PlatypusSingleProcess_3run, METH_O, __pyx_doc_13variantcaller_21PlatypusSingleProcess_2run};
static PyObject *__pyx_pw_13variantcaller_21PlatypusSingleProcess_3run(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run (wrapper)", 0);
  __pyx_r = __pyx_pf_13variantcaller_21PlatypusSingleProcess_2run(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_21PlatypusSingleProcess_2run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  struct __pyx_obj_11cpopulation_Population *__pyx_v_pop = 0;
  PyObject *__pyx_v_fo = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_end = 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 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  __Pyx_RefNannySetupContext("run", 0);

  /* "variantcaller.pyx":941
 *         # Cache reference sequence for this region. This should result in a substantial speed-up for
 *         # the fastafile.getSequence function.
 *         self.vcf = vcf.VCF()             # <<<<<<<<<<<<<<
 *         self.vcf.setheader(vcfHeader + [('platypusOptions', str(self.options))])
 *         self.vcf.setsamples(sorted(set(self.samples)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_VCF); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_vcf, __pyx_t_1) < 0) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":942
 *         # the fastafile.getSequence function.
 *         self.vcf = vcf.VCF()
 *         self.vcf.setheader(vcfHeader + [('platypusOptions', str(self.options))])             # <<<<<<<<<<<<<<
 *         self.vcf.setsamples(sorted(set(self.samples)))
 *         self.vcf.setinfo(vcfutils.vcfInfoSignature)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_setheader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_vcfHeader); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_s_platypusOptions);
  __Pyx_GIVEREF(__pyx_n_s_platypusOptions);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_platypusOptions);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __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_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":943
 *         self.vcf = vcf.VCF()
 *         self.vcf.setheader(vcfHeader + [('platypusOptions', str(self.options))])
 *         self.vcf.setsamples(sorted(set(self.samples)))             # <<<<<<<<<<<<<<
 *         self.vcf.setinfo(vcfutils.vcfInfoSignature)
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_setsamples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samples); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PySet_New(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_6 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 943, __pyx_L1_error)
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":944
 *         self.vcf.setheader(vcfHeader + [('platypusOptions', str(self.options))])
 *         self.vcf.setsamples(sorted(set(self.samples)))
 *         self.vcf.setinfo(vcfutils.vcfInfoSignature)             # <<<<<<<<<<<<<<
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)
 *         self.vcf.setformat(vcfutils.vcfFormatSignature)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_setinfo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_vcfutils); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_vcfInfoSignature); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":945
 *         self.vcf.setsamples(sorted(set(self.samples)))
 *         self.vcf.setinfo(vcfutils.vcfInfoSignature)
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)             # <<<<<<<<<<<<<<
 *         self.vcf.setformat(vcfutils.vcfFormatSignature)
 *         self.windowGenerator = window.WindowGenerator()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_setfilter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcfutils); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vcfFilterSignature); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":946
 *         self.vcf.setinfo(vcfutils.vcfInfoSignature)
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)
 *         self.vcf.setformat(vcfutils.vcfFormatSignature)             # <<<<<<<<<<<<<<
 *         self.windowGenerator = window.WindowGenerator()
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setformat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_vcfutils); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_vcfFormatSignature); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":947
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)
 *         self.vcf.setformat(vcfutils.vcfFormatSignature)
 *         self.windowGenerator = window.WindowGenerator()             # <<<<<<<<<<<<<<
 * 
 *         if self.continuing:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_window); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_WindowGenerator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_windowGenerator, __pyx_t_1) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":949
 *         self.windowGenerator = window.WindowGenerator()
 * 
 *         if self.continuing:             # <<<<<<<<<<<<<<
 *             logger.info("Opening file %s for appending" %(self.fileName))
 *             self.outputFile = Open(self.fileName, 'a')
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_continuing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":950
 * 
 *         if self.continuing:
 *             logger.info("Opening file %s for appending" %(self.fileName))             # <<<<<<<<<<<<<<
 *             self.outputFile = Open(self.fileName, 'a')
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileName); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Opening_file_s_for_appending, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "variantcaller.pyx":951
 *         if self.continuing:
 *             logger.info("Opening file %s for appending" %(self.fileName))
 *             self.outputFile = Open(self.fileName, 'a')             # <<<<<<<<<<<<<<
 *         else:
 *             if self.fileName == "-":
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Open); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileName); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_n_s_a};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_5, __pyx_n_s_a};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_5);
      __Pyx_INCREF(__pyx_n_s_a);
      __Pyx_GIVEREF(__pyx_n_s_a);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_n_s_a);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_outputFile, __pyx_t_1) < 0) __PYX_ERR(0, 951, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "variantcaller.pyx":949
 *         self.windowGenerator = window.WindowGenerator()
 * 
 *         if self.continuing:             # <<<<<<<<<<<<<<
 *             logger.info("Opening file %s for appending" %(self.fileName))
 *             self.outputFile = Open(self.fileName, 'a')
 */
    goto __pyx_L3;
  }

  /* "variantcaller.pyx":953
 *             self.outputFile = Open(self.fileName, 'a')
 *         else:
 *             if self.fileName == "-":             # <<<<<<<<<<<<<<
 *                 self.outputFile = sys.stdout
 *             else:
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__6, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 953, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":954
 *         else:
 *             if self.fileName == "-":
 *                 self.outputFile = sys.stdout             # <<<<<<<<<<<<<<
 *             else:
 *                 self.outputFile = Open(self.fileName, 'w')
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_outputFile, __pyx_t_4) < 0) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "variantcaller.pyx":953
 *             self.outputFile = Open(self.fileName, 'a')
 *         else:
 *             if self.fileName == "-":             # <<<<<<<<<<<<<<
 *                 self.outputFile = sys.stdout
 *             else:
 */
      goto __pyx_L4;
    }

    /* "variantcaller.pyx":956
 *                 self.outputFile = sys.stdout
 *             else:
 *                 self.outputFile = Open(self.fileName, 'w')             # <<<<<<<<<<<<<<
 *             self.vcf.writeheader(self.outputFile)
 * 
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileName); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_n_s_w};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_n_s_w};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_t_3);
        __Pyx_INCREF(__pyx_n_s_w);
        __Pyx_GIVEREF(__pyx_n_s_w);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_n_s_w);
        __pyx_t_3 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_outputFile, __pyx_t_4) < 0) __PYX_ERR(0, 956, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L4:;

    /* "variantcaller.pyx":957
 *             else:
 *                 self.outputFile = Open(self.fileName, 'w')
 *             self.vcf.writeheader(self.outputFile)             # <<<<<<<<<<<<<<
 * 
 *         cdef Population pop = Population(self.options)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_writeheader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_outputFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "variantcaller.pyx":959
 *             self.vcf.writeheader(self.outputFile)
 * 
 *         cdef Population pop = Population(self.options)             # <<<<<<<<<<<<<<
 *         if self.options.alignScoreFile != "":
 *             fo = open(self.options.alignScoreFile, 'w')
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_11cpopulation_Population), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_pop = ((struct __pyx_obj_11cpopulation_Population *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "variantcaller.pyx":960
 * 
 *         cdef Population pop = Population(self.options)
 *         if self.options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             fo = open(self.options.alignScoreFile, 'w')
 *             fo.write("#Alignment score File\n")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s__7, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":961
 *         cdef Population pop = Population(self.options)
 *         if self.options.alignScoreFile != "":
 *             fo = open(self.options.alignScoreFile, 'w')             # <<<<<<<<<<<<<<
 *             fo.write("#Alignment score File\n")
 *             fo.close()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_w);
    __Pyx_GIVEREF(__pyx_n_s_w);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_w);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_fo = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "variantcaller.pyx":962
 *         if self.options.alignScoreFile != "":
 *             fo = open(self.options.alignScoreFile, 'w')
 *             fo.write("#Alignment score File\n")             # <<<<<<<<<<<<<<
 *             fo.close()
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_s_Alignment_score_File) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Alignment_score_File);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "variantcaller.pyx":963
 *             fo = open(self.options.alignScoreFile, 'w')
 *             fo.write("#Alignment score File\n")
 *             fo.close()             # <<<<<<<<<<<<<<
 * 
 *         for index,(chrom,start,end) in enumerate(self.regions):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "variantcaller.pyx":960
 * 
 *         cdef Population pop = Population(self.options)
 *         if self.options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             fo = open(self.options.alignScoreFile, 'w')
 *             fo.write("#Alignment score File\n")
 */
  }

  /* "variantcaller.pyx":965
 *             fo.close()
 * 
 *         for index,(chrom,start,end) in enumerate(self.regions):             # <<<<<<<<<<<<<<
 * 
 *             if index % 10 == 0:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_2 = __pyx_int_0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_regions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 965, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 965, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 965, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 965, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 965, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_5 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_11 = __pyx_t_13(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 3) < 0) __PYX_ERR(0, 965, __pyx_L1_error)
      __pyx_t_13 = NULL;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 965, __pyx_L1_error)
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_chrom, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_2);
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":967
 *         for index,(chrom,start,end) in enumerate(self.regions):
 * 
 *             if index % 10 == 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))
 *             elif self.options.verbosity >= 3:
 */
    __pyx_t_4 = __Pyx_PyInt_RemainderObjC(__pyx_v_index, __pyx_int_10, 10, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 967, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 967, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":968
 * 
 *             if index % 10 == 0:
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))             # <<<<<<<<<<<<<<
 *             elif self.options.verbosity >= 3:
 *                 logger.info("Processing region %s:%s-%s" %(chrom, start, end))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_bufferSize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_chrom);
      __Pyx_INCREF(__pyx_v_start);
      __Pyx_GIVEREF(__pyx_v_start);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_start);
      __Pyx_INCREF(__pyx_v_end);
      __Pyx_GIVEREF(__pyx_v_end);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_end);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Processing_region_s_s_s_Only_pri, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_11 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 968, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "variantcaller.pyx":967
 *         for index,(chrom,start,end) in enumerate(self.regions):
 * 
 *             if index % 10 == 0:             # <<<<<<<<<<<<<<
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))
 *             elif self.options.verbosity >= 3:
 */
      goto __pyx_L10;
    }

    /* "variantcaller.pyx":969
 *             if index % 10 == 0:
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))
 *             elif self.options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.info("Processing region %s:%s-%s" %(chrom, start, end))
 *             else:
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 969, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":970
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))
 *             elif self.options.verbosity >= 3:
 *                 logger.info("Processing region %s:%s-%s" %(chrom, start, end))             # <<<<<<<<<<<<<<
 *             else:
 *                 pass
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logger); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_chrom);
      __Pyx_INCREF(__pyx_v_start);
      __Pyx_GIVEREF(__pyx_v_start);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_start);
      __Pyx_INCREF(__pyx_v_end);
      __Pyx_GIVEREF(__pyx_v_end);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_end);
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Processing_region_s_s_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_11 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "variantcaller.pyx":969
 *             if index % 10 == 0:
 *                 logger.info("Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)" %(chrom, start, end, self.options.bufferSize))
 *             elif self.options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                 logger.info("Processing region %s:%s-%s" %(chrom, start, end))
 *             else:
 */
      goto __pyx_L10;
    }

    /* "variantcaller.pyx":972
 *                 logger.info("Processing region %s:%s-%s" %(chrom, start, end))
 *             else:
 *                 pass             # <<<<<<<<<<<<<<
 * 
 *             if self.options.HLATyping==1:
 */
    /*else*/ {
    }
    __pyx_L10:;

    /* "variantcaller.pyx":974
 *                 pass
 * 
 *             if self.options.HLATyping==1:             # <<<<<<<<<<<<<<
 *                 callHLAVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 *             else:
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_HLATyping); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_7) {

      /* "variantcaller.pyx":975
 * 
 *             if self.options.HLATyping==1:
 *                 callHLAVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)             # <<<<<<<<<<<<<<
 *             else:
 *                 callVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 */
      if (!(likely(PyBytes_CheckExact(__pyx_v_chrom))||((__pyx_v_chrom) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_chrom)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_end); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFiles); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refFile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9fastafile_FastaFile))))) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_windowGenerator); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_outputFile); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samples); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (!(likely(PyList_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_16)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samplesByID); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (!(likely(PyDict_CheckExact(__pyx_t_17))||((__pyx_t_17) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_17)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samplesByBAM); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      if (!(likely(PyDict_CheckExact(__pyx_t_18))||((__pyx_t_18) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_18)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error)
      __pyx_f_13variantcaller_callHLAVariantsInRegion(((PyObject*)__pyx_v_chrom), __pyx_t_8, __pyx_t_14, __pyx_t_11, ((struct __pyx_obj_9fastafile_FastaFile *)__pyx_t_3), __pyx_t_4, __pyx_t_5, __pyx_t_12, __pyx_t_15, ((PyObject*)__pyx_t_16), ((PyObject*)__pyx_t_17), ((PyObject*)__pyx_t_18), __pyx_v_pop);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

      /* "variantcaller.pyx":974
 *                 pass
 * 
 *             if self.options.HLATyping==1:             # <<<<<<<<<<<<<<
 *                 callHLAVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 *             else:
 */
      goto __pyx_L11;
    }

    /* "variantcaller.pyx":977
 *                 callHLAVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 *             else:
 *                 callVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)             # <<<<<<<<<<<<<<
 * 
 *         if self.fileName != "-":
 */
    /*else*/ {
      if (!(likely(PyBytes_CheckExact(__pyx_v_chrom))||((__pyx_v_chrom) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_chrom)->tp_name), 0))) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_end); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bamFiles); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_refFile); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (!(likely(((__pyx_t_17) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_17, __pyx_ptype_9fastafile_FastaFile))))) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_windowGenerator); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_outputFile); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_vcf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samplesByID); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_samplesByBAM); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (!(likely(PyDict_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_11)->tp_name), 0))) __PYX_ERR(0, 977, __pyx_L1_error)
      __pyx_f_13variantcaller_callVariantsInRegion(((PyObject*)__pyx_v_chrom), __pyx_t_14, __pyx_t_8, __pyx_t_18, ((struct __pyx_obj_9fastafile_FastaFile *)__pyx_t_17), __pyx_t_16, __pyx_t_15, __pyx_t_12, __pyx_t_5, ((PyObject*)__pyx_t_4), ((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_11), __pyx_v_pop);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __pyx_L11:;

    /* "variantcaller.pyx":965
 *             fo.close()
 * 
 *         for index,(chrom,start,end) in enumerate(self.regions):             # <<<<<<<<<<<<<<
 * 
 *             if index % 10 == 0:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":979
 *                 callVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 * 
 *         if self.fileName != "-":             # <<<<<<<<<<<<<<
 *             self.outputFile.close()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fileName); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__6, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_7) {

    /* "variantcaller.pyx":980
 * 
 *         if self.fileName != "-":
 *             self.outputFile.close()             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_outputFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "variantcaller.pyx":979
 *                 callVariantsInRegion(chrom, start, end, self.bamFiles, self.refFile, self.options, self.windowGenerator, self.outputFile, self.vcf, self.samples, self.samplesByID, self.samplesByBAM, pop)
 * 
 *         if self.fileName != "-":             # <<<<<<<<<<<<<<
 *             self.outputFile.close()
 * 
 */
  }

  /* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */

  /* function exit code */
  __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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("variantcaller.PlatypusSingleProcess.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_pop);
  __Pyx_XDECREF(__pyx_v_fo);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_end);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":989
 *     multi-process job.
 *     """
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_20PlatypusMultiProcess_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_13variantcaller_20PlatypusMultiProcess___init__[] = "\n        Constructor. Store options and output file name\n        ";
static PyMethodDef __pyx_mdef_13variantcaller_20PlatypusMultiProcess_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_13variantcaller_20PlatypusMultiProcess_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_13variantcaller_20PlatypusMultiProcess___init__};
static PyObject *__pyx_pw_13variantcaller_20PlatypusMultiProcess_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fileName = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_v_regions = 0;
  PyObject *__pyx_v_continuing = 0;
  PyObject *__pyx_v_samples = 0;
  PyObject *__pyx_v_bamFileNames = 0;
  PyObject *__pyx_v_samplesByID = 0;
  PyObject *__pyx_v_samplesByBAM = 0;
  PyObject *__pyx_v_bamFiles = 0;
  PyObject *__pyx_v_theLocks = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fileName,&__pyx_n_s_options,&__pyx_n_s_regions,&__pyx_n_s_continuing,&__pyx_n_s_samples,&__pyx_n_s_bamFileNames,&__pyx_n_s_samplesByID,&__pyx_n_s_samplesByBAM,&__pyx_n_s_bamFiles,&__pyx_n_s_theLocks,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_False));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    values[7] = ((PyObject *)((PyObject *)Py_None));
    values[8] = ((PyObject *)((PyObject *)Py_None));
    values[9] = ((PyObject *)((PyObject *)Py_None));
    values[10] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fileName)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 1); __PYX_ERR(0, 989, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 2); __PYX_ERR(0, 989, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_regions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 3); __PYX_ERR(0, 989, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_continuing);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samples);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bamFileNames);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplesByID);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samplesByBAM);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bamFiles);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_theLocks);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 989, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  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_self = values[0];
    __pyx_v_fileName = values[1];
    __pyx_v_options = values[2];
    __pyx_v_regions = values[3];
    __pyx_v_continuing = values[4];
    __pyx_v_samples = values[5];
    __pyx_v_bamFileNames = values[6];
    __pyx_v_samplesByID = values[7];
    __pyx_v_samplesByBAM = values[8];
    __pyx_v_bamFiles = values[9];
    __pyx_v_theLocks = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 989, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("variantcaller.PlatypusMultiProcess.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_13variantcaller_20PlatypusMultiProcess___init__(__pyx_self, __pyx_v_self, __pyx_v_fileName, __pyx_v_options, __pyx_v_regions, __pyx_v_continuing, __pyx_v_samples, __pyx_v_bamFileNames, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_bamFiles, __pyx_v_theLocks);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_20PlatypusMultiProcess___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fileName, PyObject *__pyx_v_options, PyObject *__pyx_v_regions, PyObject *__pyx_v_continuing, PyObject *__pyx_v_samples, PyObject *__pyx_v_bamFileNames, PyObject *__pyx_v_samplesByID, PyObject *__pyx_v_samplesByBAM, PyObject *__pyx_v_bamFiles, PyObject *__pyx_v_theLocks) {
  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;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "variantcaller.pyx":993
 *         Constructor. Store options and output file name
 *         """
 *         multiprocessing.Process.__init__(self)             # <<<<<<<<<<<<<<
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Process); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":994
 *         """
 *         multiprocessing.Process.__init__(self)
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PlatypusSingleProcess); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_fileName, __pyx_v_options, __pyx_v_regions, __pyx_v_continuing, __pyx_v_samples, __pyx_v_bamFileNames, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_bamFiles, __pyx_v_theLocks};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[11] = {__pyx_t_3, __pyx_v_fileName, __pyx_v_options, __pyx_v_regions, __pyx_v_continuing, __pyx_v_samples, __pyx_v_bamFileNames, __pyx_v_samplesByID, __pyx_v_samplesByBAM, __pyx_v_bamFiles, __pyx_v_theLocks};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 10+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(10+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_fileName);
    __Pyx_GIVEREF(__pyx_v_fileName);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_fileName);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_options);
    __Pyx_INCREF(__pyx_v_regions);
    __Pyx_GIVEREF(__pyx_v_regions);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_regions);
    __Pyx_INCREF(__pyx_v_continuing);
    __Pyx_GIVEREF(__pyx_v_continuing);
    PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_continuing);
    __Pyx_INCREF(__pyx_v_samples);
    __Pyx_GIVEREF(__pyx_v_samples);
    PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_samples);
    __Pyx_INCREF(__pyx_v_bamFileNames);
    __Pyx_GIVEREF(__pyx_v_bamFileNames);
    PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_bamFileNames);
    __Pyx_INCREF(__pyx_v_samplesByID);
    __Pyx_GIVEREF(__pyx_v_samplesByID);
    PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_samplesByID);
    __Pyx_INCREF(__pyx_v_samplesByBAM);
    __Pyx_GIVEREF(__pyx_v_samplesByBAM);
    PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_samplesByBAM);
    __Pyx_INCREF(__pyx_v_bamFiles);
    __Pyx_GIVEREF(__pyx_v_bamFiles);
    PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_bamFiles);
    __Pyx_INCREF(__pyx_v_theLocks);
    __Pyx_GIVEREF(__pyx_v_theLocks);
    PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_theLocks);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_singleProcess, __pyx_t_1) < 0) __PYX_ERR(0, 994, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":989
 *     multi-process job.
 *     """
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */

  /* function exit code */
  __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_5);
  __Pyx_AddTraceback("variantcaller.PlatypusMultiProcess.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "variantcaller.pyx":996
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */

/* Python wrapper */
static PyObject *__pyx_pw_13variantcaller_20PlatypusMultiProcess_3run(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_13variantcaller_20PlatypusMultiProcess_2run[] = "\n        Run a single Platypus process\n        ";
static PyMethodDef __pyx_mdef_13variantcaller_20PlatypusMultiProcess_3run = {"run", (PyCFunction)__pyx_pw_13variantcaller_20PlatypusMultiProcess_3run, METH_O, __pyx_doc_13variantcaller_20PlatypusMultiProcess_2run};
static PyObject *__pyx_pw_13variantcaller_20PlatypusMultiProcess_3run(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("run (wrapper)", 0);
  __pyx_r = __pyx_pf_13variantcaller_20PlatypusMultiProcess_2run(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_13variantcaller_20PlatypusMultiProcess_2run(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("run", 0);

  /* "variantcaller.pyx":1000
 *         Run a single Platypus process
 *         """
 *         self.singleProcess.run()             # <<<<<<<<<<<<<<
 * 
 * ##################################################################################################
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_singleProcess); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":996
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */

  /* function exit code */
  __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("variantcaller.PlatypusMultiProcess.run", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "htslibWrapper.pxd":250
 * 
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":251
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 16) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":250
 * 
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":253
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsPaired(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":254
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 1) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":253
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":256
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsProperPair(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":257
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 2) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":256
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":259
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsDuplicate(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":260
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x400) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":259
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":262
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":263
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 4) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":262
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":265
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":266
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 8) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":265
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":268
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":269
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 32) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":268
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":271
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsQCFail(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":272
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x200) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":271
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":274
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReadOne(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":275
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 64) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":274
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":277
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsSecondaryAlignment(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":278
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x100) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":277
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":280
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":281
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x800) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":280
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":283
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_SetIsNotReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":284
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag &= (~BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag & (~16));

  /* "htslibWrapper.pxd":283
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "htslibWrapper.pxd":286
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_SetIsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":287
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FREVERSE             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 16);

  /* "htslibWrapper.pxd":286
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "htslibWrapper.pxd":289
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetQCFail(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":290
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FQCFAIL             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 0x200);

  /* "htslibWrapper.pxd":289
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 */

  /* function exit code */
}

/* "htslibWrapper.pxd":292
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":293
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FCOMPRESSED             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 0x800);

  /* "htslibWrapper.pxd":292
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 */

  /* function exit code */
}

/* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetUnCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":296
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag & (~0x800));

  /* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

  /* function exit code */
}

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_variantcaller(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_variantcaller},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "variantcaller",
    __pyx_k_This_module_contains_the_top_le, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_kp_s_0_0, __pyx_k_0_0, sizeof(__pyx_k_0_0), 0, 0, 1, 0},
  {&__pyx_kp_s_0_0_2, __pyx_k_0_0_2, sizeof(__pyx_k_0_0_2), 0, 0, 1, 0},
  {&__pyx_kp_s_100, __pyx_k_100, sizeof(__pyx_k_100), 0, 0, 1, 0},
  {&__pyx_kp_s_Alignment_score_File, __pyx_k_Alignment_score_File, sizeof(__pyx_k_Alignment_score_File), 0, 0, 1, 0},
  {&__pyx_kp_s_Assembly_region_windows_will_be, __pyx_k_Assembly_region_windows_will_be, sizeof(__pyx_k_Assembly_region_windows_will_be), 0, 0, 1, 0},
  {&__pyx_n_s_BRF, __pyx_k_BRF, sizeof(__pyx_k_BRF), 0, 0, 1, 1},
  {&__pyx_kp_s_But_keep_maxSize_below_5000_othe, __pyx_k_But_keep_maxSize_below_5000_othe, sizeof(__pyx_k_But_keep_maxSize_below_5000_othe), 0, 0, 1, 0},
  {&__pyx_n_s_END, __pyx_k_END, sizeof(__pyx_k_END), 0, 0, 1, 1},
  {&__pyx_kp_s_Exception_in_region_s_s_s_Error, __pyx_k_Exception_in_region_s_s_s_Error, sizeof(__pyx_k_Exception_in_region_s_s_s_Error), 0, 0, 1, 0},
  {&__pyx_kp_s_Exception_in_window_d_d_Error_wa, __pyx_k_Exception_in_window_d_d_Error_wa, sizeof(__pyx_k_Exception_in_window_d_d_Error_wa), 0, 0, 1, 0},
  {&__pyx_n_s_FR, __pyx_k_FR, sizeof(__pyx_k_FR), 0, 0, 1, 1},
  {&__pyx_n_s_FS, __pyx_k_FS, sizeof(__pyx_k_FS), 0, 0, 1, 1},
  {&__pyx_kp_s_Found_very_long_read_s_bases_Cap, __pyx_k_Found_very_long_read_s_bases_Cap, sizeof(__pyx_k_Found_very_long_read_s_bases_Cap), 0, 0, 1, 0},
  {&__pyx_n_s_GL, __pyx_k_GL, sizeof(__pyx_k_GL), 0, 0, 1, 1},
  {&__pyx_n_s_GOF, __pyx_k_GOF, sizeof(__pyx_k_GOF), 0, 0, 1, 1},
  {&__pyx_n_s_GQ, __pyx_k_GQ, sizeof(__pyx_k_GQ), 0, 0, 1, 1},
  {&__pyx_n_s_GT, __pyx_k_GT, sizeof(__pyx_k_GT), 0, 0, 1, 1},
  {&__pyx_kp_s_GT_GL_GOF_GQ_NR_NV, __pyx_k_GT_GL_GOF_GQ_NR_NV, sizeof(__pyx_k_GT_GL_GOF_GQ_NR_NV), 0, 0, 1, 0},
  {&__pyx_kp_s_GT_GL_NR_NV1_NV2, __pyx_k_GT_GL_NR_NV1_NV2, sizeof(__pyx_k_GT_GL_NR_NV1_NV2), 0, 0, 1, 0},
  {&__pyx_n_s_HLATyping, __pyx_k_HLATyping, sizeof(__pyx_k_HLATyping), 0, 0, 1, 1},
  {&__pyx_n_s_HP, __pyx_k_HP, sizeof(__pyx_k_HP), 0, 0, 1, 1},
  {&__pyx_n_s_HapScore, __pyx_k_HapScore, sizeof(__pyx_k_HapScore), 0, 0, 1, 1},
  {&__pyx_kp_s_Haplotype_d_s, __pyx_k_Haplotype_d_s, sizeof(__pyx_k_Haplotype_d_s), 0, 0, 1, 0},
  {&__pyx_kp_s_In_HLA_variant_window_d_d, __pyx_k_In_HLA_variant_window_d_d, sizeof(__pyx_k_In_HLA_variant_window_d_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Increase_maxSize_if_you_want_lon, __pyx_k_Increase_maxSize_if_you_want_lon, sizeof(__pyx_k_Increase_maxSize_if_you_want_lon), 0, 0, 1, 0},
  {&__pyx_kp_s_Invalid_reference_FASTA_file_sup, __pyx_k_Invalid_reference_FASTA_file_sup, sizeof(__pyx_k_Invalid_reference_FASTA_file_sup), 0, 0, 1, 0},
  {&__pyx_n_s_Log, __pyx_k_Log, sizeof(__pyx_k_Log), 0, 0, 1, 1},
  {&__pyx_kp_s_Longer_reads_will_be_used_for_al, __pyx_k_Longer_reads_will_be_used_for_al, sizeof(__pyx_k_Longer_reads_will_be_used_for_al), 0, 0, 1, 0},
  {&__pyx_n_s_MGOF, __pyx_k_MGOF, sizeof(__pyx_k_MGOF), 0, 0, 1, 1},
  {&__pyx_n_s_MMLQ, __pyx_k_MMLQ, sizeof(__pyx_k_MMLQ), 0, 0, 1, 1},
  {&__pyx_n_s_MQ, __pyx_k_MQ, sizeof(__pyx_k_MQ), 0, 0, 1, 1},
  {&__pyx_kp_s_Max_genotypes_s, __pyx_k_Max_genotypes_s, sizeof(__pyx_k_Max_genotypes_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Max_haplotypes_used_for_genotype, __pyx_k_Max_haplotypes_used_for_genotype, sizeof(__pyx_k_Max_haplotypes_used_for_genotype), 0, 0, 1, 0},
  {&__pyx_kp_s_Max_haplotypes_used_for_initial, __pyx_k_Max_haplotypes_used_for_initial, sizeof(__pyx_k_Max_haplotypes_used_for_initial), 0, 0, 1, 0},
  {&__pyx_kp_s_Merging_haplotypes_s_and_s, __pyx_k_Merging_haplotypes_s_and_s, sizeof(__pyx_k_Merging_haplotypes_s_and_s), 0, 0, 1, 0},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_NF, __pyx_k_NF, sizeof(__pyx_k_NF), 0, 0, 1, 1},
  {&__pyx_n_s_NR, __pyx_k_NR, sizeof(__pyx_k_NR), 0, 0, 1, 1},
  {&__pyx_n_s_NV, __pyx_k_NV, sizeof(__pyx_k_NV), 0, 0, 1, 1},
  {&__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s, __pyx_k_Need_to_assemble_s_s_s_nReads_s, sizeof(__pyx_k_Need_to_assemble_s_s_s_nReads_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Need_to_assemble_s_s_s_nReads_s_2, __pyx_k_Need_to_assemble_s_s_s_nReads_s_2, sizeof(__pyx_k_Need_to_assemble_s_s_s_nReads_s_2), 0, 0, 1, 0},
  {&__pyx_kp_s_No_coverage_in_window_s_s_s_Skip, __pyx_k_No_coverage_in_window_s_s_s_Skip, sizeof(__pyx_k_No_coverage_in_window_s_s_s_Skip), 0, 0, 1, 0},
  {&__pyx_n_s_Open, __pyx_k_Open, sizeof(__pyx_k_Open), 0, 0, 1, 1},
  {&__pyx_kp_s_Opening_file_s_for_appending, __pyx_k_Opening_file_s_for_appending, sizeof(__pyx_k_Opening_file_s_for_appending), 0, 0, 1, 0},
  {&__pyx_n_s_PLATYPUS_VERSION, __pyx_k_PLATYPUS_VERSION, sizeof(__pyx_k_PLATYPUS_VERSION), 0, 0, 1, 1},
  {&__pyx_n_s_PP, __pyx_k_PP, sizeof(__pyx_k_PP), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusMultiProcess, __pyx_k_PlatypusMultiProcess, sizeof(__pyx_k_PlatypusMultiProcess), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusMultiProcess___init, __pyx_k_PlatypusMultiProcess___init, sizeof(__pyx_k_PlatypusMultiProcess___init), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusMultiProcess_run, __pyx_k_PlatypusMultiProcess_run, sizeof(__pyx_k_PlatypusMultiProcess_run), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusSingleProcess, __pyx_k_PlatypusSingleProcess, sizeof(__pyx_k_PlatypusSingleProcess), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusSingleProcess___init, __pyx_k_PlatypusSingleProcess___init, sizeof(__pyx_k_PlatypusSingleProcess___init), 0, 0, 1, 1},
  {&__pyx_n_s_PlatypusSingleProcess_run, __pyx_k_PlatypusSingleProcess_run, sizeof(__pyx_k_PlatypusSingleProcess_run), 0, 0, 1, 1},
  {&__pyx_kp_s_Platypus_Version__s, __pyx_k_Platypus_Version__s, sizeof(__pyx_k_Platypus_Version__s), 0, 0, 1, 0},
  {&__pyx_n_s_Process, __pyx_k_Process, sizeof(__pyx_k_Process), 0, 0, 1, 1},
  {&__pyx_kp_s_Processed_sample_s_Detected_s_un, __pyx_k_Processed_sample_s_Detected_s_un, sizeof(__pyx_k_Processed_sample_s_Detected_s_un), 0, 0, 1, 0},
  {&__pyx_kp_s_Processing_region_s_s_s, __pyx_k_Processing_region_s_s_s, sizeof(__pyx_k_Processing_region_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Processing_region_s_s_s_Only_pri, __pyx_k_Processing_region_s_s_s_Only_pri, sizeof(__pyx_k_Processing_region_s_s_s_Only_pri), 0, 0, 1, 0},
  {&__pyx_kp_s_Processing_window_s_s_s, __pyx_k_Processing_window_s_s_s, sizeof(__pyx_k_Processing_window_s_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_QD, __pyx_k_QD, sizeof(__pyx_k_QD), 0, 0, 1, 1},
  {&__pyx_n_s_REFCALL, __pyx_k_REFCALL, sizeof(__pyx_k_REFCALL), 0, 0, 1, 1},
  {&__pyx_n_s_ReadPosRankSum, __pyx_k_ReadPosRankSum, sizeof(__pyx_k_ReadPosRankSum), 0, 0, 1, 1},
  {&__pyx_kp_s_Reference_file_name_s_looks_like, __pyx_k_Reference_file_name_s_looks_like, sizeof(__pyx_k_Reference_file_name_s_looks_like), 0, 0, 1, 0},
  {&__pyx_kp_s_Region_s_s_s_will_be_skipped, __pyx_k_Region_s_s_s_will_be_skipped, sizeof(__pyx_k_Region_s_s_s_will_be_skipped), 0, 0, 1, 0},
  {&__pyx_n_s_SC, __pyx_k_SC, sizeof(__pyx_k_SC), 0, 0, 1, 1},
  {&__pyx_n_s_START, __pyx_k_START, sizeof(__pyx_k_START), 0, 0, 1, 1},
  {&__pyx_n_s_SbPval, __pyx_k_SbPval, sizeof(__pyx_k_SbPval), 0, 0, 1, 1},
  {&__pyx_kp_s_Searching_for_variants_in_the_fo, __pyx_k_Searching_for_variants_in_the_fo, sizeof(__pyx_k_Searching_for_variants_in_the_fo), 0, 0, 1, 0},
  {&__pyx_n_s_SeqLength, __pyx_k_SeqLength, sizeof(__pyx_k_SeqLength), 0, 0, 1, 1},
  {&__pyx_kp_s_Simple_class_to_represent_a_sin, __pyx_k_Simple_class_to_represent_a_sin, sizeof(__pyx_k_Simple_class_to_represent_a_sin), 0, 0, 1, 0},
  {&__pyx_kp_s_Simple_class_to_represent_a_sin_2, __pyx_k_Simple_class_to_represent_a_sin_2, sizeof(__pyx_k_Simple_class_to_represent_a_sin_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Size, __pyx_k_Size, sizeof(__pyx_k_Size), 0, 0, 1, 0},
  {&__pyx_n_s_Size_2, __pyx_k_Size_2, sizeof(__pyx_k_Size_2), 0, 0, 1, 1},
  {&__pyx_kp_s_Sizes_SeqQual_s_cigar_s_read_s_p, __pyx_k_Sizes_SeqQual_s_cigar_s_read_s_p, sizeof(__pyx_k_Sizes_SeqQual_s_cigar_s_read_s_p), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_pathalogical_window_s_s, __pyx_k_Skipping_pathalogical_window_s_s, sizeof(__pyx_k_Skipping_pathalogical_window_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_region_s_s_s_as_data_co, __pyx_k_Skipping_region_s_s_s_as_data_co, sizeof(__pyx_k_Skipping_region_s_s_s_as_data_co), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_very_large_window_s_s_s, __pyx_k_Skipping_very_large_window_s_s_s, sizeof(__pyx_k_Skipping_very_large_window_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_window_with_s_variants, __pyx_k_Skipping_window_with_s_variants, sizeof(__pyx_k_Skipping_window_with_s_variants), 0, 0, 1, 0},
  {&__pyx_n_s_Source, __pyx_k_Source, sizeof(__pyx_k_Source), 0, 0, 1, 1},
  {&__pyx_n_s_StandardError, __pyx_k_StandardError, sizeof(__pyx_k_StandardError), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_TC, __pyx_k_TC, sizeof(__pyx_k_TC), 0, 0, 1, 1},
  {&__pyx_n_s_TCF, __pyx_k_TCF, sizeof(__pyx_k_TCF), 0, 0, 1, 1},
  {&__pyx_n_s_TCR, __pyx_k_TCR, sizeof(__pyx_k_TCR), 0, 0, 1, 1},
  {&__pyx_n_s_TR, __pyx_k_TR, sizeof(__pyx_k_TR), 0, 0, 1, 1},
  {&__pyx_kp_s_There_are_s_filtered_variant_can, __pyx_k_There_are_s_filtered_variant_can, sizeof(__pyx_k_There_are_s_filtered_variant_can), 0, 0, 1, 0},
  {&__pyx_kp_s_There_are_s_reads_buffer_size_s, __pyx_k_There_are_s_reads_buffer_size_s, sizeof(__pyx_k_There_are_s_reads_buffer_size_s), 0, 0, 1, 0},
  {&__pyx_kp_s_This_reduces_to_s_candidates_aft, __pyx_k_This_reduces_to_s_candidates_aft, sizeof(__pyx_k_This_reduces_to_s_candidates_aft), 0, 0, 1, 0},
  {&__pyx_kp_s_Treating_bamFiles_argument_s_as, __pyx_k_Treating_bamFiles_argument_s_as, sizeof(__pyx_k_Treating_bamFiles_argument_s_as), 0, 0, 1, 0},
  {&__pyx_n_s_VCF, __pyx_k_VCF, sizeof(__pyx_k_VCF), 0, 0, 1, 1},
  {&__pyx_n_s_VariantCandidateReader, __pyx_k_VariantCandidateReader, sizeof(__pyx_k_VariantCandidateReader), 0, 0, 1, 1},
  {&__pyx_n_s_Variants, __pyx_k_Variants, sizeof(__pyx_k_Variants), 0, 0, 1, 1},
  {&__pyx_kp_s_WE, __pyx_k_WE, sizeof(__pyx_k_WE), 0, 0, 1, 0},
  {&__pyx_n_s_WE_2, __pyx_k_WE_2, sizeof(__pyx_k_WE_2), 0, 0, 1, 1},
  {&__pyx_kp_s_WS, __pyx_k_WS, sizeof(__pyx_k_WS), 0, 0, 1, 0},
  {&__pyx_n_s_WS_2, __pyx_k_WS_2, sizeof(__pyx_k_WS_2), 0, 0, 1, 1},
  {&__pyx_n_s_WindowGenerator, __pyx_k_WindowGenerator, sizeof(__pyx_k_WindowGenerator), 0, 0, 1, 1},
  {&__pyx_kp_s_Window_s_s_s_will_be_skipped, __pyx_k_Window_s_s_s_will_be_skipped, sizeof(__pyx_k_Window_s_s_s_will_be_skipped), 0, 0, 1, 0},
  {&__pyx_n_s_WindowsAndVariants, __pyx_k_WindowsAndVariants, sizeof(__pyx_k_WindowsAndVariants), 0, 0, 1, 1},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_alignScoreFile, __pyx_k_alignScoreFile, sizeof(__pyx_k_alignScoreFile), 0, 0, 1, 1},
  {&__pyx_n_s_alt, __pyx_k_alt, sizeof(__pyx_k_alt), 0, 0, 1, 1},
  {&__pyx_n_s_assemble, __pyx_k_assemble, sizeof(__pyx_k_assemble), 0, 0, 1, 1},
  {&__pyx_n_s_assembleAll, __pyx_k_assembleAll, sizeof(__pyx_k_assembleAll), 0, 0, 1, 1},
  {&__pyx_n_s_assemblerKmerSize, __pyx_k_assemblerKmerSize, sizeof(__pyx_k_assemblerKmerSize), 0, 0, 1, 1},
  {&__pyx_n_s_assemblyRegionSize, __pyx_k_assemblyRegionSize, sizeof(__pyx_k_assemblyRegionSize), 0, 0, 1, 1},
  {&__pyx_kp_s_bam, __pyx_k_bam, sizeof(__pyx_k_bam), 0, 0, 1, 0},
  {&__pyx_n_s_bamFileNames, __pyx_k_bamFileNames, sizeof(__pyx_k_bamFileNames), 0, 0, 1, 1},
  {&__pyx_n_s_bamFiles, __pyx_k_bamFiles, sizeof(__pyx_k_bamFiles), 0, 0, 1, 1},
  {&__pyx_kp_s_bgz, __pyx_k_bgz, sizeof(__pyx_k_bgz), 0, 0, 1, 0},
  {&__pyx_n_s_bisect, __pyx_k_bisect, sizeof(__pyx_k_bisect), 0, 0, 1, 1},
  {&__pyx_n_s_bufferSize, __pyx_k_bufferSize, sizeof(__pyx_k_bufferSize), 0, 0, 1, 1},
  {&__pyx_kp_s_bz2, __pyx_k_bz2, sizeof(__pyx_k_bz2), 0, 0, 1, 0},
  {&__pyx_n_s_chaplotype, __pyx_k_chaplotype, sizeof(__pyx_k_chaplotype), 0, 0, 1, 1},
  {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1},
  {&__pyx_n_s_chromosome, __pyx_k_chromosome, sizeof(__pyx_k_chromosome), 0, 0, 1, 1},
  {&__pyx_n_s_cigarSize, __pyx_k_cigarSize, sizeof(__pyx_k_cigarSize), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_compressReads, __pyx_k_compressReads, sizeof(__pyx_k_compressReads), 0, 0, 1, 1},
  {&__pyx_n_s_continuing, __pyx_k_continuing, sizeof(__pyx_k_continuing), 0, 0, 1, 1},
  {&__pyx_n_s_countTotalReadsInRegion, __pyx_k_countTotalReadsInRegion, sizeof(__pyx_k_countTotalReadsInRegion), 0, 0, 1, 1},
  {&__pyx_kp_s_cram, __pyx_k_cram, sizeof(__pyx_k_cram), 0, 0, 1, 0},
  {&__pyx_kp_s_cython_variantcaller_pyx, __pyx_k_cython_variantcaller_pyx, sizeof(__pyx_k_cython_variantcaller_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1},
  {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_endPos, __pyx_k_endPos, sizeof(__pyx_k_endPos), 0, 0, 1, 1},
  {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
  {&__pyx_kp_s_fai, __pyx_k_fai, sizeof(__pyx_k_fai), 0, 0, 1, 0},
  {&__pyx_n_s_fileDate, __pyx_k_fileDate, sizeof(__pyx_k_fileDate), 0, 0, 1, 1},
  {&__pyx_n_s_fileName, __pyx_k_fileName, sizeof(__pyx_k_fileName), 0, 0, 1, 1},
  {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
  {&__pyx_n_s_filterVarsByCoverage, __pyx_k_filterVarsByCoverage, sizeof(__pyx_k_filterVarsByCoverage), 0, 0, 1, 1},
  {&__pyx_n_s_fo, __pyx_k_fo, sizeof(__pyx_k_fo), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fromtimestamp, __pyx_k_fromtimestamp, sizeof(__pyx_k_fromtimestamp), 0, 0, 1, 1},
  {&__pyx_n_s_genIndels, __pyx_k_genIndels, sizeof(__pyx_k_genIndels), 0, 0, 1, 1},
  {&__pyx_n_s_genSNPs, __pyx_k_genSNPs, sizeof(__pyx_k_genSNPs), 0, 0, 1, 1},
  {&__pyx_n_s_getBAMFileNamesFromTextFile, __pyx_k_getBAMFileNamesFromTextFile, sizeof(__pyx_k_getBAMFileNamesFromTextFile), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_getSampleNamesAndLoadIterators, __pyx_k_getSampleNamesAndLoadIterators, sizeof(__pyx_k_getSampleNamesAndLoadIterators), 0, 0, 1, 1},
  {&__pyx_n_s_getVariantsFromBAMs, __pyx_k_getVariantsFromBAMs, sizeof(__pyx_k_getVariantsFromBAMs), 0, 0, 1, 1},
  {&__pyx_n_s_granularity, __pyx_k_granularity, sizeof(__pyx_k_granularity), 0, 0, 1, 1},
  {&__pyx_kp_s_gz, __pyx_k_gz, sizeof(__pyx_k_gz), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_isBamOrCram, __pyx_k_isBamOrCram, sizeof(__pyx_k_isBamOrCram), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_linefilter, __pyx_k_linefilter, sizeof(__pyx_k_linefilter), 0, 0, 1, 1},
  {&__pyx_n_s_lineinfo, __pyx_k_lineinfo, sizeof(__pyx_k_lineinfo), 0, 0, 1, 1},
  {&__pyx_n_s_logger, __pyx_k_logger, sizeof(__pyx_k_logger), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_maxGenotypes, __pyx_k_maxGenotypes, sizeof(__pyx_k_maxGenotypes), 0, 0, 1, 1},
  {&__pyx_n_s_maxHaplotypes, __pyx_k_maxHaplotypes, sizeof(__pyx_k_maxHaplotypes), 0, 0, 1, 1},
  {&__pyx_n_s_maxPost, __pyx_k_maxPost, sizeof(__pyx_k_maxPost), 0, 0, 1, 1},
  {&__pyx_n_s_maxProbVar, __pyx_k_maxProbVar, sizeof(__pyx_k_maxProbVar), 0, 0, 1, 1},
  {&__pyx_n_s_maxReads, __pyx_k_maxReads, sizeof(__pyx_k_maxReads), 0, 0, 1, 1},
  {&__pyx_n_s_maxRefPos, __pyx_k_maxRefPos, sizeof(__pyx_k_maxRefPos), 0, 0, 1, 1},
  {&__pyx_n_s_maxSize, __pyx_k_maxSize, sizeof(__pyx_k_maxSize), 0, 0, 1, 1},
  {&__pyx_n_s_maxVariants, __pyx_k_maxVariants, sizeof(__pyx_k_maxVariants), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_minBaseQual, __pyx_k_minBaseQual, sizeof(__pyx_k_minBaseQual), 0, 0, 1, 1},
  {&__pyx_n_s_minCov, __pyx_k_minCov, sizeof(__pyx_k_minCov), 0, 0, 1, 1},
  {&__pyx_n_s_minFlank, __pyx_k_minFlank, sizeof(__pyx_k_minFlank), 0, 0, 1, 1},
  {&__pyx_n_s_minMapQual, __pyx_k_minMapQual, sizeof(__pyx_k_minMapQual), 0, 0, 1, 1},
  {&__pyx_n_s_minReads, __pyx_k_minReads, sizeof(__pyx_k_minReads), 0, 0, 1, 1},
  {&__pyx_n_s_minRefPos, __pyx_k_minRefPos, sizeof(__pyx_k_minRefPos), 0, 0, 1, 1},
  {&__pyx_n_s_minVarFreq, __pyx_k_minVarFreq, sizeof(__pyx_k_minVarFreq), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1},
  {&__pyx_n_s_nCombinationsWithReplacement, __pyx_k_nCombinationsWithReplacement, sizeof(__pyx_k_nCombinationsWithReplacement), 0, 0, 1, 1},
  {&__pyx_n_s_nInd, __pyx_k_nInd, sizeof(__pyx_k_nInd), 0, 0, 1, 1},
  {&__pyx_n_s_nIndividuals, __pyx_k_nIndividuals, sizeof(__pyx_k_nIndividuals), 0, 0, 1, 1},
  {&__pyx_n_s_nVar, __pyx_k_nVar, sizeof(__pyx_k_nVar), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_originalMaxHaplotypes, __pyx_k_originalMaxHaplotypes, sizeof(__pyx_k_originalMaxHaplotypes), 0, 0, 1, 1},
  {&__pyx_n_s_outputFile, __pyx_k_outputFile, sizeof(__pyx_k_outputFile), 0, 0, 1, 1},
  {&__pyx_n_s_outputRefCall, __pyx_k_outputRefCall, sizeof(__pyx_k_outputRefCall), 0, 0, 1, 1},
  {&__pyx_n_s_outputRefCalls, __pyx_k_outputRefCalls, sizeof(__pyx_k_outputRefCalls), 0, 0, 1, 1},
  {&__pyx_n_s_phredPValue, __pyx_k_phredPValue, sizeof(__pyx_k_phredPValue), 0, 0, 1, 1},
  {&__pyx_n_s_platypusOptions, __pyx_k_platypusOptions, sizeof(__pyx_k_platypusOptions), 0, 0, 1, 1},
  {&__pyx_n_s_platypusutils, __pyx_k_platypusutils, sizeof(__pyx_k_platypusutils), 0, 0, 1, 1},
  {&__pyx_n_s_pointerSize, __pyx_k_pointerSize, sizeof(__pyx_k_pointerSize), 0, 0, 1, 1},
  {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_probRef, __pyx_k_probRef, sizeof(__pyx_k_probRef), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qual, __pyx_k_qual, sizeof(__pyx_k_qual), 0, 0, 1, 1},
  {&__pyx_n_s_qualBinSize, __pyx_k_qualBinSize, sizeof(__pyx_k_qualBinSize), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_readBuffers, __pyx_k_readBuffers, sizeof(__pyx_k_readBuffers), 0, 0, 1, 1},
  {&__pyx_n_s_readSize, __pyx_k_readSize, sizeof(__pyx_k_readSize), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_refCallBlockSize, __pyx_k_refCallBlockSize, sizeof(__pyx_k_refCallBlockSize), 0, 0, 1, 1},
  {&__pyx_n_s_refFile, __pyx_k_refFile, sizeof(__pyx_k_refFile), 0, 0, 1, 1},
  {&__pyx_n_s_regions, __pyx_k_regions, sizeof(__pyx_k_regions), 0, 0, 1, 1},
  {&__pyx_n_s_rlen, __pyx_k_rlen, sizeof(__pyx_k_rlen), 0, 0, 1, 1},
  {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1},
  {&__pyx_n_s_samplesByBAM, __pyx_k_samplesByBAM, sizeof(__pyx_k_samplesByBAM), 0, 0, 1, 1},
  {&__pyx_n_s_samplesByID, __pyx_k_samplesByID, sizeof(__pyx_k_samplesByID), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_seqQualSize, __pyx_k_seqQualSize, sizeof(__pyx_k_seqQualSize), 0, 0, 1, 1},
  {&__pyx_n_s_setfilter, __pyx_k_setfilter, sizeof(__pyx_k_setfilter), 0, 0, 1, 1},
  {&__pyx_n_s_setformat, __pyx_k_setformat, sizeof(__pyx_k_setformat), 0, 0, 1, 1},
  {&__pyx_n_s_setheader, __pyx_k_setheader, sizeof(__pyx_k_setheader), 0, 0, 1, 1},
  {&__pyx_n_s_setinfo, __pyx_k_setinfo, sizeof(__pyx_k_setinfo), 0, 0, 1, 1},
  {&__pyx_n_s_setsamples, __pyx_k_setsamples, sizeof(__pyx_k_setsamples), 0, 0, 1, 1},
  {&__pyx_n_s_singleProcess, __pyx_k_singleProcess, sizeof(__pyx_k_singleProcess), 0, 0, 1, 1},
  {&__pyx_n_s_skipDifficultWindows, __pyx_k_skipDifficultWindows, sizeof(__pyx_k_skipDifficultWindows), 0, 0, 1, 1},
  {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1},
  {&__pyx_n_s_sourceFile, __pyx_k_sourceFile, sizeof(__pyx_k_sourceFile), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_startPos, __pyx_k_startPos, sizeof(__pyx_k_startPos), 0, 0, 1, 1},
  {&__pyx_kp_s_start_end_of_region_d_d, __pyx_k_start_end_of_region_d_d, sizeof(__pyx_k_start_end_of_region_d_d), 0, 0, 1, 0},
  {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_theBamFile, __pyx_k_theBamFile, sizeof(__pyx_k_theBamFile), 0, 0, 1, 1},
  {&__pyx_n_s_theBuffer, __pyx_k_theBuffer, sizeof(__pyx_k_theBuffer), 0, 0, 1, 1},
  {&__pyx_n_s_theFormat, __pyx_k_theFormat, sizeof(__pyx_k_theFormat), 0, 0, 1, 1},
  {&__pyx_n_s_theLock, __pyx_k_theLock, sizeof(__pyx_k_theLock), 0, 0, 1, 1},
  {&__pyx_n_s_theLocks, __pyx_k_theLocks, sizeof(__pyx_k_theLocks), 0, 0, 1, 1},
  {&__pyx_n_s_theReadBuffer, __pyx_k_theReadBuffer, sizeof(__pyx_k_theReadBuffer), 0, 0, 1, 1},
  {&__pyx_n_s_theStart, __pyx_k_theStart, sizeof(__pyx_k_theStart), 0, 0, 1, 1},
  {&__pyx_n_s_thisBadBufferSize, __pyx_k_thisBadBufferSize, sizeof(__pyx_k_thisBadBufferSize), 0, 0, 1, 1},
  {&__pyx_n_s_thisBufferSize, __pyx_k_thisBufferSize, sizeof(__pyx_k_thisBufferSize), 0, 0, 1, 1},
  {&__pyx_n_s_thisSample, __pyx_k_thisSample, sizeof(__pyx_k_thisSample), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_totalBufferSize, __pyx_k_totalBufferSize, sizeof(__pyx_k_totalBufferSize), 0, 0, 1, 1},
  {&__pyx_n_s_totalReads, __pyx_k_totalReads, sizeof(__pyx_k_totalReads), 0, 0, 1, 1},
  {&__pyx_n_s_totalSeqQualSize, __pyx_k_totalSeqQualSize, sizeof(__pyx_k_totalSeqQualSize), 0, 0, 1, 1},
  {&__pyx_n_s_totalSize, __pyx_k_totalSize, sizeof(__pyx_k_totalSize), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_variantcaller, __pyx_k_variantcaller, sizeof(__pyx_k_variantcaller), 0, 0, 1, 1},
  {&__pyx_n_s_variants, __pyx_k_variants, sizeof(__pyx_k_variants), 0, 0, 1, 1},
  {&__pyx_n_s_variantutils, __pyx_k_variantutils, sizeof(__pyx_k_variantutils), 0, 0, 1, 1},
  {&__pyx_n_s_vcf, __pyx_k_vcf, sizeof(__pyx_k_vcf), 0, 0, 1, 1},
  {&__pyx_n_s_vcfDataLine, __pyx_k_vcfDataLine, sizeof(__pyx_k_vcfDataLine), 0, 0, 1, 1},
  {&__pyx_n_s_vcfFile, __pyx_k_vcfFile, sizeof(__pyx_k_vcfFile), 0, 0, 1, 1},
  {&__pyx_n_s_vcfFilterSignature, __pyx_k_vcfFilterSignature, sizeof(__pyx_k_vcfFilterSignature), 0, 0, 1, 1},
  {&__pyx_n_s_vcfFormatSignature, __pyx_k_vcfFormatSignature, sizeof(__pyx_k_vcfFormatSignature), 0, 0, 1, 1},
  {&__pyx_n_s_vcfHeader, __pyx_k_vcfHeader, sizeof(__pyx_k_vcfHeader), 0, 0, 1, 1},
  {&__pyx_n_s_vcfInfoSignature, __pyx_k_vcfInfoSignature, sizeof(__pyx_k_vcfInfoSignature), 0, 0, 1, 1},
  {&__pyx_n_s_vcfutils, __pyx_k_vcfutils, sizeof(__pyx_k_vcfutils), 0, 0, 1, 1},
  {&__pyx_n_s_verbosity, __pyx_k_verbosity, sizeof(__pyx_k_verbosity), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1},
  {&__pyx_n_s_window, __pyx_k_window, sizeof(__pyx_k_window), 0, 0, 1, 1},
  {&__pyx_n_s_windowEnd, __pyx_k_windowEnd, sizeof(__pyx_k_windowEnd), 0, 0, 1, 1},
  {&__pyx_n_s_windowGenerator, __pyx_k_windowGenerator, sizeof(__pyx_k_windowGenerator), 0, 0, 1, 1},
  {&__pyx_n_s_windowIndex, __pyx_k_windowIndex, sizeof(__pyx_k_windowIndex), 0, 0, 1, 1},
  {&__pyx_n_s_windowSize, __pyx_k_windowSize, sizeof(__pyx_k_windowSize), 0, 0, 1, 1},
  {&__pyx_n_s_windowStart, __pyx_k_windowStart, sizeof(__pyx_k_windowStart), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_write_data, __pyx_k_write_data, sizeof(__pyx_k_write_data), 0, 0, 1, 1},
  {&__pyx_n_s_writeheader, __pyx_k_writeheader, sizeof(__pyx_k_writeheader), 0, 0, 1, 1},
  {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 871, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 233, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 502, __pyx_L1_error)
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 502, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 502, __pyx_L1_error)
  #endif
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 591, __pyx_L1_error)
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 592, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 892, __pyx_L1_error)
  __pyx_builtin_StandardError = __Pyx_GetBuiltinName(__pyx_n_s_StandardError); if (!__pyx_builtin_StandardError) __PYX_ERR(0, 911, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 961, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "variantcaller.pyx":901
 *         self.bamFileNames = options.bamFiles
 * 
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))             # <<<<<<<<<<<<<<
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:
 */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s_bam, __pyx_kp_s_cram); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "variantcaller.pyx":50
 * from platypusutils import Open
 * 
 * logger = logging.getLogger("Log")             # <<<<<<<<<<<<<<
 * vcfHeader = [('fileDate',datetime.date.fromtimestamp(time.time())), ('source','Platypus_Version_%s' %(platypusutils.PLATYPUS_VERSION))]
 * 
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_Log); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */
  __pyx_tuple__9 = PyTuple_Pack(13, __pyx_n_s_readBuffers, __pyx_n_s_theReadBuffer, __pyx_n_s_totalReads, __pyx_n_s_cigarSize, __pyx_n_s_seqQualSize, __pyx_n_s_readSize, __pyx_n_s_pointerSize, __pyx_n_s_totalBufferSize, __pyx_n_s_totalSeqQualSize, __pyx_n_s_thisBufferSize, __pyx_n_s_thisBadBufferSize, __pyx_n_s_i, __pyx_n_s_totalSize); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_countTotalReadsInRegion, 209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 209, __pyx_L1_error)

  /* "variantcaller.pyx":764
 * ###################################################################################################
 * 
 * def outputRefCall(bytes chrom, Population pop, vcfFile, FastaFile refFile, outputFile, int windowIndex, dict window, options, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_tuple__11 = PyTuple_Pack(34, __pyx_n_s_chrom, __pyx_n_s_pop, __pyx_n_s_vcfFile, __pyx_n_s_refFile, __pyx_n_s_outputFile, __pyx_n_s_windowIndex, __pyx_n_s_window, __pyx_n_s_options, __pyx_n_s_readBuffers, __pyx_n_s_windowStart, __pyx_n_s_windowEnd, __pyx_n_s_windowSize, __pyx_n_s_variants, __pyx_n_s_nIndividuals, __pyx_n_s_theBuffer, __pyx_n_s_minCov, __pyx_n_s_theStart, __pyx_n_s_granularity, __pyx_n_s_index, __pyx_n_s_phredPValue, __pyx_n_s_qual, __pyx_n_s_maxPost, __pyx_n_s_maxProbVar, __pyx_n_s_probRef, __pyx_n_s_ref, __pyx_n_s_alt, __pyx_n_s_id, __pyx_n_s_linefilter, __pyx_n_s_lineinfo, __pyx_n_s_theFormat, __pyx_n_s_vcfDataLine, __pyx_n_s_i, __pyx_n_s_thisSample, __pyx_n_s_v); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);
  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(9, 0, 34, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_outputRefCall, 764, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 764, __pyx_L1_error)

  /* "variantcaller.pyx":871
 * ###################################################################################################
 * 
 * class PlatypusSingleProcess(object):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process.
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "variantcaller.pyx":880
 *     bamFiles = None
 * 
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */
  __pyx_tuple__14 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_fileName, __pyx_n_s_options, __pyx_n_s_regions, __pyx_n_s_continuing, __pyx_n_s_samples, __pyx_n_s_bamFileNames, __pyx_n_s_samplesByID, __pyx_n_s_samplesByBAM, __pyx_n_s_bamFiles, __pyx_n_s_theLocks, __pyx_n_s_theBamFile, __pyx_n_s_theLock, __pyx_n_s_isBamOrCram); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(11, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_init, 880, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 880, __pyx_L1_error)
  __pyx_tuple__16 = PyTuple_Pack(7, ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_tuple__17 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_pop, __pyx_n_s_fo, __pyx_n_s_index, __pyx_n_s_chrom, __pyx_n_s_start, __pyx_n_s_end); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_run, 935, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 935, __pyx_L1_error)

  /* "variantcaller.pyx":989
 *     multi-process job.
 *     """
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */
  __pyx_tuple__19 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_fileName, __pyx_n_s_options, __pyx_n_s_regions, __pyx_n_s_continuing, __pyx_n_s_samples, __pyx_n_s_bamFileNames, __pyx_n_s_samplesByID, __pyx_n_s_samplesByBAM, __pyx_n_s_bamFiles, __pyx_n_s_theLocks); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(11, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_init, 989, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 989, __pyx_L1_error)
  __pyx_tuple__21 = PyTuple_Pack(7, ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "variantcaller.pyx":996
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_variantcaller_pyx, __pyx_n_s_run, 996, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_0_1 = PyFloat_FromDouble(-0.1); if (unlikely(!__pyx_float_neg_0_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_257 = PyInt_FromLong(257); if (unlikely(!__pyx_int_257)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("fastafile"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_9fastafile_FastaIndex = __Pyx_ImportType(__pyx_t_1, "fastafile", "FastaIndex", sizeof(struct __pyx_obj_9fastafile_FastaIndex), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9fastafile_FastaIndex) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_vtabptr_9fastafile_FastaIndex = (struct __pyx_vtabstruct_9fastafile_FastaIndex*)__Pyx_GetVtable(__pyx_ptype_9fastafile_FastaIndex->tp_dict); if (unlikely(!__pyx_vtabptr_9fastafile_FastaIndex)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_ptype_9fastafile_FastaFile = __Pyx_ImportType(__pyx_t_1, "fastafile", "FastaFile", sizeof(struct __pyx_obj_9fastafile_FastaFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9fastafile_FastaFile) __PYX_ERR(1, 5, __pyx_L1_error)
  __pyx_vtabptr_9fastafile_FastaFile = (struct __pyx_vtabstruct_9fastafile_FastaFile*)__Pyx_GetVtable(__pyx_ptype_9fastafile_FastaFile->tp_dict); if (unlikely(!__pyx_vtabptr_9fastafile_FastaFile)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("htslibWrapper"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_13htslibWrapper_Samfile = __Pyx_ImportType(__pyx_t_1, "htslibWrapper", "Samfile", sizeof(struct __pyx_obj_13htslibWrapper_Samfile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_13htslibWrapper_Samfile) __PYX_ERR(5, 203, __pyx_L1_error)
  __pyx_vtabptr_13htslibWrapper_Samfile = (struct __pyx_vtabstruct_13htslibWrapper_Samfile*)__Pyx_GetVtable(__pyx_ptype_13htslibWrapper_Samfile->tp_dict); if (unlikely(!__pyx_vtabptr_13htslibWrapper_Samfile)) __PYX_ERR(5, 203, __pyx_L1_error)
  __pyx_ptype_13htslibWrapper_ReadIterator = __Pyx_ImportType(__pyx_t_1, "htslibWrapper", "ReadIterator", sizeof(struct __pyx_obj_13htslibWrapper_ReadIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_13htslibWrapper_ReadIterator) __PYX_ERR(5, 222, __pyx_L1_error)
  __pyx_vtabptr_13htslibWrapper_ReadIterator = (struct __pyx_vtabstruct_13htslibWrapper_ReadIterator*)__Pyx_GetVtable(__pyx_ptype_13htslibWrapper_ReadIterator->tp_dict); if (unlikely(!__pyx_vtabptr_13htslibWrapper_ReadIterator)) __PYX_ERR(5, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("variant"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7variant_Variant = __Pyx_ImportType(__pyx_t_1, "variant", "Variant", sizeof(struct __pyx_obj_7variant_Variant), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7variant_Variant) __PYX_ERR(6, 17, __pyx_L1_error)
  __pyx_vtabptr_7variant_Variant = (struct __pyx_vtabstruct_7variant_Variant*)__Pyx_GetVtable(__pyx_ptype_7variant_Variant->tp_dict); if (unlikely(!__pyx_vtabptr_7variant_Variant)) __PYX_ERR(6, 17, __pyx_L1_error)
  __pyx_ptype_7variant_VariantCandidateGenerator = __Pyx_ImportType(__pyx_t_1, "variant", "VariantCandidateGenerator", sizeof(struct __pyx_obj_7variant_VariantCandidateGenerator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7variant_VariantCandidateGenerator) __PYX_ERR(6, 44, __pyx_L1_error)
  __pyx_vtabptr_7variant_VariantCandidateGenerator = (struct __pyx_vtabstruct_7variant_VariantCandidateGenerator*)__Pyx_GetVtable(__pyx_ptype_7variant_VariantCandidateGenerator->tp_dict); if (unlikely(!__pyx_vtabptr_7variant_VariantCandidateGenerator)) __PYX_ERR(6, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cwindow"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cwindow_ReadArray = __Pyx_ImportType(__pyx_t_1, "cwindow", "ReadArray", sizeof(struct __pyx_obj_7cwindow_ReadArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cwindow_ReadArray) __PYX_ERR(7, 13, __pyx_L1_error)
  __pyx_vtabptr_7cwindow_ReadArray = (struct __pyx_vtabstruct_7cwindow_ReadArray*)__Pyx_GetVtable(__pyx_ptype_7cwindow_ReadArray->tp_dict); if (unlikely(!__pyx_vtabptr_7cwindow_ReadArray)) __PYX_ERR(7, 13, __pyx_L1_error)
  __pyx_ptype_7cwindow_bamReadBuffer = __Pyx_ImportType(__pyx_t_1, "cwindow", "bamReadBuffer", sizeof(struct __pyx_obj_7cwindow_bamReadBuffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cwindow_bamReadBuffer) __PYX_ERR(7, 29, __pyx_L1_error)
  __pyx_vtabptr_7cwindow_bamReadBuffer = (struct __pyx_vtabstruct_7cwindow_bamReadBuffer*)__Pyx_GetVtable(__pyx_ptype_7cwindow_bamReadBuffer->tp_dict); if (unlikely(!__pyx_vtabptr_7cwindow_bamReadBuffer)) __PYX_ERR(7, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cpopulation"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_11cpopulation_Population = __Pyx_ImportType(__pyx_t_1, "cpopulation", "Population", sizeof(struct __pyx_obj_11cpopulation_Population), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_11cpopulation_Population) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_vtabptr_11cpopulation_Population = (struct __pyx_vtabstruct_11cpopulation_Population*)__Pyx_GetVtable(__pyx_ptype_11cpopulation_Population->tp_dict); if (unlikely(!__pyx_vtabptr_11cpopulation_Population)) __PYX_ERR(8, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("chaplotype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_10chaplotype_Haplotype = __Pyx_ImportType(__pyx_t_1, "chaplotype", "Haplotype", sizeof(struct __pyx_obj_10chaplotype_Haplotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10chaplotype_Haplotype) __PYX_ERR(9, 14, __pyx_L1_error)
  __pyx_vtabptr_10chaplotype_Haplotype = (struct __pyx_vtabstruct_10chaplotype_Haplotype*)__Pyx_GetVtable(__pyx_ptype_10chaplotype_Haplotype->tp_dict); if (unlikely(!__pyx_vtabptr_10chaplotype_Haplotype)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cgenotype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_9cgenotype_DiploidGenotype = __Pyx_ImportType(__pyx_t_1, "cgenotype", "DiploidGenotype", sizeof(struct __pyx_obj_9cgenotype_DiploidGenotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9cgenotype_DiploidGenotype) __PYX_ERR(10, 9, __pyx_L1_error)
  __pyx_vtabptr_9cgenotype_DiploidGenotype = (struct __pyx_vtabstruct_9cgenotype_DiploidGenotype*)__Pyx_GetVtable(__pyx_ptype_9cgenotype_DiploidGenotype->tp_dict); if (unlikely(!__pyx_vtabptr_9cgenotype_DiploidGenotype)) __PYX_ERR(10, 9, __pyx_L1_error)
  __pyx_ptype_9cgenotype_HaploidGenotype = __Pyx_ImportType(__pyx_t_1, "cgenotype", "HaploidGenotype", sizeof(struct __pyx_obj_9cgenotype_HaploidGenotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9cgenotype_HaploidGenotype) __PYX_ERR(10, 17, __pyx_L1_error)
  __pyx_vtabptr_9cgenotype_HaploidGenotype = (struct __pyx_vtabstruct_9cgenotype_HaploidGenotype*)__Pyx_GetVtable(__pyx_ptype_9cgenotype_HaploidGenotype->tp_dict); if (unlikely(!__pyx_vtabptr_9cgenotype_HaploidGenotype)) __PYX_ERR(10, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __pyx_t_1 = PyImport_ImportModule("variant"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "PLATYPUS_VAR", (void **)&__pyx_vp_7variant_PLATYPUS_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "FILE_VAR", (void **)&__pyx_vp_7variant_FILE_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "ASSEMBLER_VAR", (void **)&__pyx_vp_7variant_ASSEMBLER_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_import_code(void) {
  __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;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("platypusutils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "betaBinomialCDF", (void (**)(void))&__pyx_f_13platypusutils_betaBinomialCDF, "double (int, int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "loadBAMData", (void (**)(void))&__pyx_f_13platypusutils_loadBAMData, "PyObject *(PyObject *, PyObject *, int, int, PyObject *, PyObject *, PyObject *, PyObject *, char *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "leftNormaliseIndel", (void (**)(void))&__pyx_f_13platypusutils_leftNormaliseIndel, "struct __pyx_obj_7variant_Variant *(struct __pyx_obj_7variant_Variant *, struct __pyx_obj_9fastafile_FastaFile *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = PyImport_ImportModule("vcfutils"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "outputCallToVCF", (void (**)(void))&__pyx_f_8vcfutils_outputCallToVCF, "void (PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, double *, double **, double **, int **, PyObject *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "refAndAlt", (void (**)(void))&__pyx_f_8vcfutils_refAndAlt, "PyObject *(char *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_2, "outputHLACallToVCF", (void (**)(void))&__pyx_f_8vcfutils_outputHLACallToVCF, "void (PyObject *, PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = PyImport_ImportModule("variantFilter"); if (!__pyx_t_3) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "filterVariants", (void (**)(void))&__pyx_f_13variantFilter_filterVariants, "PyObject *(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, int, int, int, int, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "filterVariantsInWindow", (void (**)(void))&__pyx_f_13variantFilter_filterVariantsInWindow, "void (PyObject *, PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "filterVariantsByCoverage", (void (**)(void))&__pyx_f_13variantFilter_filterVariantsByCoverage, "void (PyObject *, PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "getHaplotypesInWindow", (void (**)(void))&__pyx_f_13variantFilter_getHaplotypesInWindow, "PyObject *(PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, int, int, int, int, int, int, int, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "padVariants", (void (**)(void))&__pyx_f_13variantFilter_padVariants, "PyObject *(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "computeVariantReadSupportFrac", (void (**)(void))&__pyx_f_13variantFilter_computeVariantReadSupportFrac, "double (struct __pyx_obj_7variant_Variant *, struct __pyx_obj_7cwindow_bamReadBuffer *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "getAllHLAHaplotypesInRegion", (void (**)(void))&__pyx_f_13variantFilter_getAllHLAHaplotypesInRegion, "PyObject *(PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "normaliseVar", (void (**)(void))&__pyx_f_13variantFilter_normaliseVar, "struct __pyx_obj_7variant_Variant *(struct __pyx_obj_7variant_Variant *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "trimLongVar", (void (**)(void))&__pyx_f_13variantFilter_trimLongVar, "struct __pyx_obj_7variant_Variant *(struct __pyx_obj_7variant_Variant *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_3, "getAllAssemblerHaplotypesInRegion", (void (**)(void))&__pyx_f_13variantFilter_getAllAssemblerHaplotypesInRegion, "PyObject *(PyObject *, int, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, struct __pyx_obj_10chaplotype_Haplotype *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyImport_ImportModule("cgenotype"); if (!__pyx_t_4) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_4, "generateAllGenotypesFromHaplotypeList", (void (**)(void))&__pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = PyImport_ImportModule("assembler"); if (!__pyx_t_5) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_5, "assembleReadsAndDetectVariants", (void (**)(void))&__pyx_f_9assembler_assembleReadsAndDetectVariants, "PyObject *(char *, int, int, int, int, PyObject *, char *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __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_RefNannyFinishContext();
  return -1;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initvariantcaller(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initvariantcaller(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_variantcaller(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_variantcaller(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_variantcaller(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'variantcaller' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #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("__Pyx_PyMODINIT_FUNC PyInit_variantcaller(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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 CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("variantcaller", __pyx_methods, __pyx_k_This_module_contains_the_top_le, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_variantcaller) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "variantcaller")) {
      if (unlikely(PyDict_SetItemString(modules, "variantcaller", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  (void)__Pyx_modinit_type_init_code();
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_variable_import_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "variantcaller.pyx":7
 * from __future__ import division
 * 
 * import logging             # <<<<<<<<<<<<<<
 * import multiprocessing
 * import window
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":8
 * 
 * import logging
 * import multiprocessing             # <<<<<<<<<<<<<<
 * import window
 * import vcf
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":9
 * import logging
 * import multiprocessing
 * import window             # <<<<<<<<<<<<<<
 * import vcf
 * import variantutils
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_window, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_window, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":10
 * import multiprocessing
 * import window
 * import vcf             # <<<<<<<<<<<<<<
 * import variantutils
 * import time
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_vcf, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcf, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":11
 * import window
 * import vcf
 * import variantutils             # <<<<<<<<<<<<<<
 * import time
 * import datetime
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_variantutils, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_variantutils, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":12
 * import vcf
 * import variantutils
 * import time             # <<<<<<<<<<<<<<
 * import datetime
 * import platypusutils
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":13
 * import variantutils
 * import time
 * import datetime             # <<<<<<<<<<<<<<
 * import platypusutils
 * import vcfutils
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":14
 * import time
 * import datetime
 * import platypusutils             # <<<<<<<<<<<<<<
 * import vcfutils
 * import chaplotype
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_platypusutils, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_platypusutils, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":15
 * import datetime
 * import platypusutils
 * import vcfutils             # <<<<<<<<<<<<<<
 * import chaplotype
 * import sys
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_vcfutils, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcfutils, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":16
 * import platypusutils
 * import vcfutils
 * import chaplotype             # <<<<<<<<<<<<<<
 * import sys
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_chaplotype, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chaplotype, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":17
 * import vcfutils
 * import chaplotype
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cimport platypusutils
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":45
 * from platypusutils cimport loadBAMData
 * from assembler cimport assembleReadsAndDetectVariants
 * from bisect import bisect             # <<<<<<<<<<<<<<
 * from platypusutils cimport leftNormaliseIndel
 * from platypusutils cimport betaBinomialCDF
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_bisect);
  __Pyx_GIVEREF(__pyx_n_s_bisect);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bisect);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_bisect, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bisect); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bisect, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":48
 * from platypusutils cimport leftNormaliseIndel
 * from platypusutils cimport betaBinomialCDF
 * from platypusutils import Open             # <<<<<<<<<<<<<<
 * 
 * logger = logging.getLogger("Log")
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Open);
  __Pyx_GIVEREF(__pyx_n_s_Open);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Open);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_platypusutils, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Open, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":50
 * from platypusutils import Open
 * 
 * logger = logging.getLogger("Log")             # <<<<<<<<<<<<<<
 * vcfHeader = [('fileDate',datetime.date.fromtimestamp(time.time())), ('source','Platypus_Version_%s' %(platypusutils.PLATYPUS_VERSION))]
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":51
 * 
 * logger = logging.getLogger("Log")
 * vcfHeader = [('fileDate',datetime.date.fromtimestamp(time.time())), ('source','Platypus_Version_%s' %(platypusutils.PLATYPUS_VERSION))]             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_fromtimestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_fileDate);
  __Pyx_GIVEREF(__pyx_n_s_fileDate);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_fileDate);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_platypusutils); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_PLATYPUS_VERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Platypus_Version__s, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_source);
  __Pyx_GIVEREF(__pyx_n_s_source);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_source);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcfHeader, __pyx_t_3) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_13variantcaller_1countTotalReadsInRegion, NULL, __pyx_n_s_variantcaller); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_countTotalReadsInRegion, __pyx_t_3) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":764
 * ###################################################################################################
 * 
 * def outputRefCall(bytes chrom, Population pop, vcfFile, FastaFile refFile, outputFile, int windowIndex, dict window, options, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_13variantcaller_3outputRefCall, NULL, __pyx_n_s_variantcaller); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_outputRefCall, __pyx_t_3) < 0) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":871
 * ###################################################################################################
 * 
 * class PlatypusSingleProcess(object):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process.
 */
  __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_tuple__13, __pyx_n_s_PlatypusSingleProcess, __pyx_n_s_PlatypusSingleProcess, (PyObject *) NULL, __pyx_n_s_variantcaller, __pyx_kp_s_Simple_class_to_represent_a_sin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "variantcaller.pyx":875
 *     Simple class to represent a single Platypus process.
 *     """
 *     samples = None             # <<<<<<<<<<<<<<
 *     samplesByID = None
 *     samplesByBAM = None
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_samples, Py_None) < 0) __PYX_ERR(0, 875, __pyx_L1_error)

  /* "variantcaller.pyx":876
 *     """
 *     samples = None
 *     samplesByID = None             # <<<<<<<<<<<<<<
 *     samplesByBAM = None
 *     bamFiles = None
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_samplesByID, Py_None) < 0) __PYX_ERR(0, 876, __pyx_L1_error)

  /* "variantcaller.pyx":877
 *     samples = None
 *     samplesByID = None
 *     samplesByBAM = None             # <<<<<<<<<<<<<<
 *     bamFiles = None
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_samplesByBAM, Py_None) < 0) __PYX_ERR(0, 877, __pyx_L1_error)

  /* "variantcaller.pyx":878
 *     samplesByID = None
 *     samplesByBAM = None
 *     bamFiles = None             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_bamFiles, Py_None) < 0) __PYX_ERR(0, 878, __pyx_L1_error)

  /* "variantcaller.pyx":880
 *     bamFiles = None
 * 
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_21PlatypusSingleProcess_1__init__, 0, __pyx_n_s_PlatypusSingleProcess___init, NULL, __pyx_n_s_variantcaller, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__16);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_21PlatypusSingleProcess_3run, 0, __pyx_n_s_PlatypusSingleProcess_run, NULL, __pyx_n_s_variantcaller, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_run, __pyx_t_2) < 0) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":871
 * ###################################################################################################
 * 
 * class PlatypusSingleProcess(object):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process.
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_PlatypusSingleProcess, __pyx_tuple__13, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PlatypusSingleProcess, __pyx_t_2) < 0) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":984
 * ###################################################################################################
 * 
 * class PlatypusMultiProcess(multiprocessing.Process):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process, which is run as part of a
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Process); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_PlatypusMultiProcess, __pyx_n_s_PlatypusMultiProcess, (PyObject *) NULL, __pyx_n_s_variantcaller, __pyx_kp_s_Simple_class_to_represent_a_sin_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "variantcaller.pyx":989
 *     multi-process job.
 *     """
 *     def __init__(self, fileName, options, regions, continuing=False, samples=None, bamFileNames=None, samplesByID=None, samplesByBAM=None, bamFiles=None, theLocks=None):             # <<<<<<<<<<<<<<
 *         """
 *         Constructor. Store options and output file name
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_20PlatypusMultiProcess_1__init__, 0, __pyx_n_s_PlatypusMultiProcess___init, NULL, __pyx_n_s_variantcaller, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__21);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 989, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":996
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_20PlatypusMultiProcess_3run, 0, __pyx_n_s_PlatypusMultiProcess_run, NULL, __pyx_n_s_variantcaller, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_run, __pyx_t_4) < 0) __PYX_ERR(0, 996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":984
 * ###################################################################################################
 * 
 * class PlatypusMultiProcess(multiprocessing.Process):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process, which is run as part of a
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_PlatypusMultiProcess, __pyx_t_3, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PlatypusMultiProcess, __pyx_t_4) < 0) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":1
 * """             # <<<<<<<<<<<<<<
 * This module contains the top-level variant-calling
 * code, including a VariantCaller class.
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

  /*--- Wrapped vars code ---*/

  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);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init variantcaller", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init variantcaller");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* ExtTypeTest */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
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);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_FloorDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b)
            if (unlikely(b == -1 && ((unsigned long)a) == 0-(unsigned long)a))
                return PyInt_Type.tp_as_number->nb_floor_divide(op1, op2);
            else {
                long q, r;
                q = a / b;
                r = a - q*b;
                q -= ((r != 0) & ((r ^ b) < 0));
                x = q;
            }
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_floor_divide(op1, op2);
            }
        }
                __Pyx_PyInt_FloorDivideObjC_ZeroDivisionError(b)
                {
                    long q, r;
                    q = a / b;
                    r = a - q*b;
                    q -= ((r != 0) & ((r ^ b) < 0));
                    x = q;
                }
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                {
                    PY_LONG_LONG q, r;
                    q = lla / llb;
                    r = lla - q*llb;
                    q -= ((r != 0) & ((r ^ llb) < 0));
                    llx = q;
                }
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceFloorDivide : PyNumber_FloorDivide)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    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;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* RaiseArgTupleInvalid */
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,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyIntFromDouble */
  #if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#endif

/* BytesEquals */
  static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* RaiseException */
  #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        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;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyIntCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* UnicodeEquals */
  static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_RemainderObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
            x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
            }
        }
                __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
                x = a % b;
                x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
  static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Import */
  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
  static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* CalculateMetaclass */
  static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* FetchCommonType */
  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
  #include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* Py3ClassCreate */
  static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PY_LONG_LONG(PY_LONG_LONG value) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(PY_LONG_LONG),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value) {
    const ptrdiff_t neg_one = (ptrdiff_t) ((ptrdiff_t) 0 - (ptrdiff_t) 1), const_zero = (ptrdiff_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(ptrdiff_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(ptrdiff_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(ptrdiff_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(ptrdiff_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(ptrdiff_t),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            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;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PY_LONG_LONG) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (PY_LONG_LONG) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PY_LONG_LONG val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            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;
            }
#endif
            return (PY_LONG_LONG) -1;
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PY_LONG_LONG) -1;
        val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
}

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            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;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
  #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
  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);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* VoidPtrImport */
  #ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* FunctionImport */
  #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* InitStrings */
  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
        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;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  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;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
