/* Generated by Cython 0.19.1 on Wed Jun 28 05:32:00 2017 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER)
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__variantcaller
#define __PYX_HAVE_API__variantcaller
#include "string.h"
#include "stdio.h"
#include "pythread.h"
#include "stdlib.h"
#include "math.h"
#include "ctype.h"
#include "stdint.h"
#include "htslib/bgzf.h"
#include "htslib/hts.h"
#include "htslib/sam.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

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


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

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


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

/*--- Type declarations ---*/
struct __pyx_obj_7variant_VariantCandidateGenerator;
struct __pyx_obj_10chaplotype_Haplotype;
struct __pyx_obj_9fastafile_FastaFile;
struct __pyx_obj_11cpopulation_Population;
struct __pyx_obj_7cwindow_ReadArray;
struct __pyx_obj_13htslibWrapper_Samfile;
struct __pyx_obj_9cgenotype_DiploidGenotype;
struct __pyx_obj_9fastafile_FastaIndex;
struct __pyx_obj_9cgenotype_HaploidGenotype;
struct __pyx_obj_13htslibWrapper_ReadIterator;
struct __pyx_obj_7cwindow_bamReadBuffer;
struct __pyx_obj_7variant_Variant;
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;
};
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults1;
typedef struct __pyx_defaults1 __pyx_defaults1;
struct __pyx_defaults {
  PyObject *__pyx_arg_continuing;
};
struct __pyx_defaults1 {
  PyObject *__pyx_arg_continuing;
};

/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};


/* "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;
};



/* "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;


/* "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;


/* "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;


/* "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;


/* "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;


/* "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;


/* "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;


/* "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":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;


/* "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;
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

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

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

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

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

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/

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

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

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) {
    PyObject *method, *result = NULL;
    if (unlikely(!args)) return NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
    result = PyObject_Call(method, args, NULL);
    Py_DECREF(method);
bad:
    Py_DECREF(args);
    return result;
}
#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3))
#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2))
#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \
    __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1))
#define __Pyx_PyObject_CallMethod0(obj, name) \
    __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple))

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2,
                                             int is_tuple, int has_known_size, int decref_tuple);

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);

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

#if CYTHON_COMPILING_IN_CPYTHON
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

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

#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); /*proto*/
#else
#define __Pyx_PyDict_Keys(d) PyDict_Keys(d)
#endif

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

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

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

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

#include <string.h>

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

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

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact
#define PyAnySet_CheckExact(ob) \
    ((ob)->ob_type == &PySet_Type || \
     (ob)->ob_type == &PyFrozenSet_Type)
#define PySet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)
#define Pyx_PyFrozenSet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)
#define PySet_Size(anyset) \
    PyObject_Size((anyset))
#define PySet_Contains(anyset, key) \
    PySequence_Contains((anyset), (key))
#define PySet_Pop(set) \
    PyObject_CallMethod(set, (char *)"pop", NULL)
static CYTHON_INLINE int PySet_Clear(PyObject *set) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}
static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}
static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}
#endif /* PyAnySet_CheckExact (<= Py2.4) */
#endif /* < Py2.5  */

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

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

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

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

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

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

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *qualname, PyObject *modname); /*proto*/

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_check_binary_version(void);

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

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

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

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

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

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

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

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


/* Module declarations from '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 'cpython.ref' */

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from '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"
int __pyx_module_is_main_variantcaller = 0;

/* Implementation of 'variantcaller' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_Exception;
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 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_4__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* 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_4__defaults__(CYTHON_UNUSED PyObject *__pyx_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 char __pyx_k_1[] = "No coverage in window %s:%s-%s. Skipping";
static char __pyx_k_2[] = "Skipping pathalogical window %s:%s-%s with %s reads";
static char __pyx_k_3[] = "skipDifficultWindows";
static char __pyx_k_4[] = "Skipping window with %s variants";
static char __pyx_k_5[] = "filterVarsByCoverage";
static char __pyx_k_6[] = "In HLA variant window %d %d";
static char __pyx_k_7[] = "Processing window %s:%s-%s";
static char __pyx_k_8[] = "Sizes: SeqQual = %s. cigar = %s. read = %s. pointers = %s. Total = %s";
static char __pyx_k_9[] = "Need to assemble %s:%s-%s. nReads = %s. nGaps = %s. n per read = %s";
static char __pyx_k_10[] = "Need to assemble %s:%s-%s. nReads = %s. nImproper = %s. fraction = %s";
static char __pyx_k_11[] = "Merging haplotypes %s and %s";
static char __pyx_k_12[] = "countTotalReadsInRegion";
static char __pyx_k_13[] = "There are %s reads (buffer size = %s. Total reads size = %s bytes) in the region %s:%s-%s";
static char __pyx_k_14[] = "Processed sample %s. Detected %s unfiltered variant candidates so far";
static char __pyx_k_15[] = "This reduces to %s candidates after coverage-filtering";
static char __pyx_k_16[] = "Found very long read (%s bases). Capping max read length at --maxSize (%s).";
static char __pyx_k_17[] = "Longer reads will be used for alignments but not to determine window boundaries";
static char __pyx_k_19[] = "Increase --maxSize if you want longer reads to be used for determining widow boundaries";
static char __pyx_k_21[] = "But keep --maxSize below 5000 otherwise problems will occur downstream and may lead to crashes";
static char __pyx_k_23[] = "VariantCandidateReader";
static char __pyx_k_24[] = "Assembly region windows will be tiled. Each region will start %s bases after the last one";
static char __pyx_k_25[] = "There are %s filtered variant candidates in reads which overlap the region %s:%s-%s";
static char __pyx_k_26[] = "Exception in region %s:%s-%s. Error was %s";
static char __pyx_k_27[] = "Region %s:%s-%s will be skipped";
static char __pyx_k_28[] = "Skipping region %s:%s-%s as data could not be loaded";
static char __pyx_k_29[] = "Skipping very large window %s:%s-%s of size %s. Max window size is %s (set in option --maxSize)";
static char __pyx_k_30[] = "Exception in window %d-%d. Error was %s";
static char __pyx_k_31[] = "Window %s:%s-%s will be skipped";
static char __pyx_k_32[] = "start - end of region %d - %d";
static char __pyx_k_33[] = "GT:GL:NR:NV1:NV2";
static char __pyx_k_34[] = "WS=";
static char __pyx_k_35[] = ";WE=";
static char __pyx_k_36[] = ";Size=";
static char __pyx_k_37[] = "\t";
static char __pyx_k_38[] = ".";
static char __pyx_k_39[] = ":";
static char __pyx_k_40[] = "0/0";
static char __pyx_k_41[] = "0.0";
static char __pyx_k_42[] = "%s\n";
static char __pyx_k_43[] = "Haplotype %d: %s";
static char __pyx_k_44[] = "GT:GL:GOF:GQ:NR:NV";
static char __pyx_k_45[] = "/";
static char __pyx_k_46[] = "Searching for variants in the following regions: %s";
static char __pyx_k_47[] = ".bam";
static char __pyx_k_48[] = ".cram";
static char __pyx_k_51[] = "Treating --bamFiles argument, %s as a text file containing a list of BAM file names";
static char __pyx_k_52[] = "getBAMFileNamesFromTextFile";
static char __pyx_k_53[] = "getSampleNamesAndLoadIterators";
static char __pyx_k_54[] = ".gz";
static char __pyx_k_56[] = ".bz2";
static char __pyx_k_58[] = ".bgz";
static char __pyx_k_60[] = "Reference file-name (%s) looks like a compressed file-name. Please un-compress the reference FASTA file before running Platypus";
static char __pyx_k_61[] = "Invalid reference FASTA file supplied";
static char __pyx_k_62[] = ".fai";
static char __pyx_k_63[] = "originalMaxHaplotypes";
static char __pyx_k_64[] = "nCombinationsWithReplacement";
static char __pyx_k_65[] = "Max haplotypes used for initial haplotype filtering = %s";
static char __pyx_k_66[] = "Max haplotypes used for genotype generation = %s";
static char __pyx_k_67[] = "Max genotypes = %s";
static char __pyx_k_68[] = "Opening file %s for appending";
static char __pyx_k_69[] = "-";
static char __pyx_k_70[] = "";
static char __pyx_k_71[] = "#Alignment score File\n";
static char __pyx_k_73[] = "Processing region %s:%s-%s. (Only printing this message every 10 regions of size %s)";
static char __pyx_k_74[] = "Processing region %s:%s-%s";
static char __pyx_k_75[] = "PlatypusSingleProcess";
static char __pyx_k_76[] = "\nThis module contains the top-level variant-calling\ncode, including a VariantCaller class.\n";
static char __pyx_k_78[] = "Platypus_Version_%s";
static char __pyx_k_81[] = "/home/chapmanb/bio/Platypus/src/cython/variantcaller.pyx";
static char __pyx_k_86[] = "PlatypusSingleProcess.__init__";
static char __pyx_k_89[] = "PlatypusSingleProcess.run";
static char __pyx_k_90[] = "\n    Simple class to represent a single Platypus process.\n    ";
static char __pyx_k_93[] = "PlatypusMultiProcess.__init__";
static char __pyx_k_96[] = "PlatypusMultiProcess.run";
static char __pyx_k_97[] = "\n    Simple class to represent a single Platypus process, which is run as part of a\n    multi-process job.\n    ";
static char __pyx_k_98[] = "PlatypusMultiProcess";
static char __pyx_k__N[] = "N";
static char __pyx_k__T[] = "T";
static char __pyx_k__a[] = "a";
static char __pyx_k__i[] = "i";
static char __pyx_k__v[] = "v";
static char __pyx_k__w[] = "w";
static char __pyx_k__FR[] = "FR";
static char __pyx_k__FS[] = "FS";
static char __pyx_k__GL[] = "GL";
static char __pyx_k__GQ[] = "GQ";
static char __pyx_k__GT[] = "GT";
static char __pyx_k__HP[] = "HP";
static char __pyx_k__MQ[] = "MQ";
static char __pyx_k__NF[] = "NF";
static char __pyx_k__NR[] = "NR";
static char __pyx_k__NV[] = "NV";
static char __pyx_k__PP[] = "PP";
static char __pyx_k__QD[] = "QD";
static char __pyx_k__SC[] = "SC";
static char __pyx_k__TC[] = "TC";
static char __pyx_k__TR[] = "TR";
static char __pyx_k__WE[] = "WE";
static char __pyx_k__WS[] = "WS";
static char __pyx_k__fo[] = "fo";
static char __pyx_k__id[] = "id";
static char __pyx_k__100[] = "100";
static char __pyx_k__BRF[] = "BRF";
static char __pyx_k__END[] = "END";
static char __pyx_k__GOF[] = "GOF";
static char __pyx_k__Log[] = "Log";
static char __pyx_k__TCF[] = "TCF";
static char __pyx_k__TCR[] = "TCR";
static char __pyx_k__VCF[] = "VCF";
static char __pyx_k__alt[] = "alt";
static char __pyx_k__end[] = "end";
static char __pyx_k__max[] = "max";
static char __pyx_k__min[] = "min";
static char __pyx_k__pop[] = "pop";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__ref[] = "ref";
static char __pyx_k__run[] = "run";
static char __pyx_k__sys[] = "sys";
static char __pyx_k__vcf[] = "vcf";
static char __pyx_k__zip[] = "zip";
static char __pyx_k__MGOF[] = "MGOF";
static char __pyx_k__MMLQ[] = "MMLQ";
static char __pyx_k__Open[] = "Open";
static char __pyx_k__Size[] = "Size";
static char __pyx_k__date[] = "date";
static char __pyx_k__info[] = "info";
static char __pyx_k__join[] = "join";
static char __pyx_k__keys[] = "keys";
static char __pyx_k__nInd[] = "nInd";
static char __pyx_k__nVar[] = "nVar";
static char __pyx_k__open[] = "open";
static char __pyx_k__qual[] = "qual";
static char __pyx_k__rlen[] = "rlen";
static char __pyx_k__self[] = "self";
static char __pyx_k__time[] = "time";
static char __pyx_k__START[] = "START";
static char __pyx_k__chrom[] = "chrom";
static char __pyx_k__close[] = "close";
static char __pyx_k__debug[] = "debug";
static char __pyx_k__error[] = "error";
static char __pyx_k__index[] = "index";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__range[] = "range";
static char __pyx_k__start[] = "start";
static char __pyx_k__write[] = "write";
static char __pyx_k__SbPval[] = "SbPval";
static char __pyx_k__Source[] = "Source";
static char __pyx_k__bisect[] = "bisect";
static char __pyx_k__endPos[] = "endPos";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__filter[] = "filter";
static char __pyx_k__format[] = "format";
static char __pyx_k__logger[] = "logger";
static char __pyx_k__minCov[] = "minCov";
static char __pyx_k__object[] = "object";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__source[] = "source";
static char __pyx_k__stdout[] = "stdout";
static char __pyx_k__window[] = "window";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__Process[] = "Process";
static char __pyx_k__REFCALL[] = "REFCALL";
static char __pyx_k__genSNPs[] = "genSNPs";
static char __pyx_k__logging[] = "logging";
static char __pyx_k__maxPost[] = "maxPost";
static char __pyx_k__maxSize[] = "maxSize";
static char __pyx_k__options[] = "options";
static char __pyx_k__probRef[] = "probRef";
static char __pyx_k__refFile[] = "refFile";
static char __pyx_k__regions[] = "regions";
static char __pyx_k__samples[] = "samples";
static char __pyx_k__setinfo[] = "setinfo";
static char __pyx_k__theLock[] = "theLock";
static char __pyx_k__vcfFile[] = "vcfFile";
static char __pyx_k__warning[] = "warning";
static char __pyx_k__HapScore[] = "HapScore";
static char __pyx_k__Variants[] = "Variants";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__assemble[] = "assemble";
static char __pyx_k__bamFiles[] = "bamFiles";
static char __pyx_k__datetime[] = "datetime";
static char __pyx_k__endswith[] = "endswith";
static char __pyx_k__fileDate[] = "fileDate";
static char __pyx_k__fileName[] = "fileName";
static char __pyx_k__lineinfo[] = "lineinfo";
static char __pyx_k__maxReads[] = "maxReads";
static char __pyx_k__minFlank[] = "minFlank";
static char __pyx_k__minReads[] = "minReads";
static char __pyx_k__readSize[] = "readSize";
static char __pyx_k__startPos[] = "startPos";
static char __pyx_k__theLocks[] = "theLocks";
static char __pyx_k__theStart[] = "theStart";
static char __pyx_k__variants[] = "variants";
static char __pyx_k__vcfutils[] = "vcfutils";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__HLATyping[] = "HLATyping";
static char __pyx_k__SeqLength[] = "SeqLength";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__cigarSize[] = "cigarSize";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__exception[] = "exception";
static char __pyx_k__genIndels[] = "genIndels";
static char __pyx_k__getLogger[] = "getLogger";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__maxRefPos[] = "maxRefPos";
static char __pyx_k__minRefPos[] = "minRefPos";
static char __pyx_k__setfilter[] = "setfilter";
static char __pyx_k__setformat[] = "setformat";
static char __pyx_k__setheader[] = "setheader";
static char __pyx_k__theBuffer[] = "theBuffer";
static char __pyx_k__theFormat[] = "theFormat";
static char __pyx_k__totalSize[] = "totalSize";
static char __pyx_k__vcfHeader[] = "vcfHeader";
static char __pyx_k__verbosity[] = "verbosity";
static char __pyx_k__windowEnd[] = "windowEnd";
static char __pyx_k____import__[] = "__import__";
static char __pyx_k____module__[] = "__module__";
static char __pyx_k__bufferSize[] = "bufferSize";
static char __pyx_k__chaplotype[] = "chaplotype";
static char __pyx_k__chromosome[] = "chromosome";
static char __pyx_k__continuing[] = "continuing";
static char __pyx_k__linefilter[] = "linefilter";
static char __pyx_k__maxProbVar[] = "maxProbVar";
static char __pyx_k__minMapQual[] = "minMapQual";
static char __pyx_k__minVarFreq[] = "minVarFreq";
static char __pyx_k__outputFile[] = "outputFile";
static char __pyx_k__setsamples[] = "setsamples";
static char __pyx_k__sourceFile[] = "sourceFile";
static char __pyx_k__theBamFile[] = "theBamFile";
static char __pyx_k__thisSample[] = "thisSample";
static char __pyx_k__totalReads[] = "totalReads";
static char __pyx_k__windowSize[] = "windowSize";
static char __pyx_k__write_data[] = "write_data";
static char __pyx_k__assembleAll[] = "assembleAll";
static char __pyx_k__granularity[] = "granularity";
static char __pyx_k__isBamOrCram[] = "isBamOrCram";
static char __pyx_k__maxVariants[] = "maxVariants";
static char __pyx_k__minBaseQual[] = "minBaseQual";
static char __pyx_k__phredPValue[] = "phredPValue";
static char __pyx_k__pointerSize[] = "pointerSize";
static char __pyx_k__qualBinSize[] = "qualBinSize";
static char __pyx_k__readBuffers[] = "readBuffers";
static char __pyx_k__samplesByID[] = "samplesByID";
static char __pyx_k__seqQualSize[] = "seqQualSize";
static char __pyx_k__vcfDataLine[] = "vcfDataLine";
static char __pyx_k__windowIndex[] = "windowIndex";
static char __pyx_k__windowStart[] = "windowStart";
static char __pyx_k__writeheader[] = "writeheader";
static char __pyx_k____qualname__[] = "__qualname__";
static char __pyx_k__bamFileNames[] = "bamFileNames";
static char __pyx_k__maxGenotypes[] = "maxGenotypes";
static char __pyx_k__nIndividuals[] = "nIndividuals";
static char __pyx_k__samplesByBAM[] = "samplesByBAM";
static char __pyx_k__variantutils[] = "variantutils";
static char __pyx_k__StandardError[] = "StandardError";
static char __pyx_k____metaclass__[] = "__metaclass__";
static char __pyx_k__compressReads[] = "compressReads";
static char __pyx_k__fromtimestamp[] = "fromtimestamp";
static char __pyx_k__maxHaplotypes[] = "maxHaplotypes";
static char __pyx_k__outputRefCall[] = "outputRefCall";
static char __pyx_k__platypusutils[] = "platypusutils";
static char __pyx_k__singleProcess[] = "singleProcess";
static char __pyx_k__theReadBuffer[] = "theReadBuffer";
static char __pyx_k__variantcaller[] = "variantcaller";
static char __pyx_k__ReadPosRankSum[] = "ReadPosRankSum";
static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
static char __pyx_k__alignScoreFile[] = "alignScoreFile";
static char __pyx_k__outputRefCalls[] = "outputRefCalls";
static char __pyx_k__thisBufferSize[] = "thisBufferSize";
static char __pyx_k__WindowGenerator[] = "WindowGenerator";
static char __pyx_k__multiprocessing[] = "multiprocessing";
static char __pyx_k__platypusOptions[] = "platypusOptions";
static char __pyx_k__totalBufferSize[] = "totalBufferSize";
static char __pyx_k__windowGenerator[] = "windowGenerator";
static char __pyx_k__PLATYPUS_VERSION[] = "PLATYPUS_VERSION";
static char __pyx_k__refCallBlockSize[] = "refCallBlockSize";
static char __pyx_k__totalSeqQualSize[] = "totalSeqQualSize";
static char __pyx_k__vcfInfoSignature[] = "vcfInfoSignature";
static char __pyx_k__assemblerKmerSize[] = "assemblerKmerSize";
static char __pyx_k__thisBadBufferSize[] = "thisBadBufferSize";
static char __pyx_k__WindowsAndVariants[] = "WindowsAndVariants";
static char __pyx_k__assemblyRegionSize[] = "assemblyRegionSize";
static char __pyx_k__vcfFilterSignature[] = "vcfFilterSignature";
static char __pyx_k__vcfFormatSignature[] = "vcfFormatSignature";
static char __pyx_k__getVariantsFromBAMs[] = "getVariantsFromBAMs";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_n_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_n_s_23;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_n_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_kp_s_43;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_kp_s_46;
static PyObject *__pyx_kp_s_47;
static PyObject *__pyx_kp_s_48;
static PyObject *__pyx_n_s_5;
static PyObject *__pyx_kp_s_51;
static PyObject *__pyx_n_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_kp_s_56;
static PyObject *__pyx_kp_s_58;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_n_s_63;
static PyObject *__pyx_n_s_64;
static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_kp_s_66;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s_68;
static PyObject *__pyx_kp_s_69;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_70;
static PyObject *__pyx_kp_s_71;
static PyObject *__pyx_kp_s_73;
static PyObject *__pyx_kp_s_74;
static PyObject *__pyx_n_s_75;
static PyObject *__pyx_kp_s_78;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_81;
static PyObject *__pyx_n_s_86;
static PyObject *__pyx_n_s_89;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_kp_s_90;
static PyObject *__pyx_n_s_93;
static PyObject *__pyx_n_s_96;
static PyObject *__pyx_kp_s_97;
static PyObject *__pyx_n_s_98;
static PyObject *__pyx_kp_s__100;
static PyObject *__pyx_n_s__BRF;
static PyObject *__pyx_n_s__END;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__FR;
static PyObject *__pyx_n_s__FS;
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_n_s__HLATyping;
static PyObject *__pyx_n_s__HP;
static PyObject *__pyx_n_s__HapScore;
static PyObject *__pyx_n_s__Log;
static PyObject *__pyx_n_s__MGOF;
static PyObject *__pyx_n_s__MMLQ;
static PyObject *__pyx_n_s__MQ;
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_n_s__Open;
static PyObject *__pyx_n_s__PLATYPUS_VERSION;
static PyObject *__pyx_n_s__PP;
static PyObject *__pyx_n_s__Process;
static PyObject *__pyx_n_s__QD;
static PyObject *__pyx_n_s__REFCALL;
static PyObject *__pyx_n_s__ReadPosRankSum;
static PyObject *__pyx_n_s__SC;
static PyObject *__pyx_n_s__START;
static PyObject *__pyx_n_s__SbPval;
static PyObject *__pyx_n_s__SeqLength;
static PyObject *__pyx_n_s__Size;
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_n_s__VCF;
static PyObject *__pyx_n_s__Variants;
static PyObject *__pyx_n_s__WE;
static PyObject *__pyx_n_s__WS;
static PyObject *__pyx_n_s__WindowGenerator;
static PyObject *__pyx_n_s__WindowsAndVariants;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____import__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____metaclass__;
static PyObject *__pyx_n_s____module__;
static PyObject *__pyx_n_s____pyx_vtable__;
static PyObject *__pyx_n_s____qualname__;
static PyObject *__pyx_n_s____test__;
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_n_s__bamFileNames;
static PyObject *__pyx_n_s__bamFiles;
static PyObject *__pyx_n_s__bisect;
static PyObject *__pyx_n_s__bufferSize;
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__close;
static PyObject *__pyx_n_s__compressReads;
static PyObject *__pyx_n_s__continuing;
static PyObject *__pyx_n_s__date;
static PyObject *__pyx_n_s__datetime;
static PyObject *__pyx_n_s__debug;
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_n_s__extend;
static PyObject *__pyx_n_s__fileDate;
static PyObject *__pyx_n_s__fileName;
static PyObject *__pyx_n_s__filter;
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__getLogger;
static PyObject *__pyx_n_s__getVariantsFromBAMs;
static PyObject *__pyx_n_s__granularity;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__index;
static PyObject *__pyx_n_s__info;
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__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__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__multiprocessing;
static PyObject *__pyx_n_s__nInd;
static PyObject *__pyx_n_s__nIndividuals;
static PyObject *__pyx_n_s__nVar;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__open;
static PyObject *__pyx_n_s__options;
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__probRef;
static PyObject *__pyx_n_s__qual;
static PyObject *__pyx_n_s__qualBinSize;
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_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__sorted;
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_n_s__stdout;
static PyObject *__pyx_n_s__sys;
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_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_neg_1;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_257;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_72;
static PyObject *__pyx_k_tuple_77;
static PyObject *__pyx_k_tuple_79;
static PyObject *__pyx_k_tuple_82;
static PyObject *__pyx_k_tuple_84;
static PyObject *__pyx_k_tuple_87;
static PyObject *__pyx_k_tuple_91;
static PyObject *__pyx_k_tuple_94;
static PyObject *__pyx_k_codeobj_80;
static PyObject *__pyx_k_codeobj_83;
static PyObject *__pyx_k_codeobj_85;
static PyObject *__pyx_k_codeobj_88;
static PyObject *__pyx_k_codeobj_92;
static PyObject *__pyx_k_codeobj_95;

/* "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;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__chromosome)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __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 bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __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 list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_empty_tuple));
  __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple));
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10chaplotype_Haplotype)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = ((PyObject *)__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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
    __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));
  }
  __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_7 = ((__pyx_v_nReadsThisWindow == 0) != 0);
  if (__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    __pyx_t_8 = __pyx_t_9;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  if (__pyx_t_8) {

    /* "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_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {

      /* "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_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "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;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "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_3 = PyInt_FromLong(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxReads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {

    /* "variantcaller.pyx":101
 * 
 *     if nReadsThisWindow > options.maxReads:
 *         logger.debug("Skipping pathalogical window %s:%s-%s with %s reads" %(chrom, windowStart, windowEnd, nReadsThisWindow))             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "variantcaller.pyx":104
 *         return
 * 
 *     if len(variants) > options.maxVariants:             # <<<<<<<<<<<<<<
 * 
 *         if options.skipDifficultWindows:
 */
  if (unlikely(((PyObject *)__pyx_v_variants) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_variants)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxVariants); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "variantcaller.pyx":106
 *     if len(variants) > options.maxVariants:
 * 
 *         if options.skipDifficultWindows:             # <<<<<<<<<<<<<<
 *             logger.debug("Skipping window with %s variants" %(len(variants)))
 *             return
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "variantcaller.pyx":107
 * 
 *         if options.skipDifficultWindows:
 *             logger.debug("Skipping window with %s variants" %(len(variants)))             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(((PyObject *)__pyx_v_variants) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_variants)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

    /* "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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {

      /* "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);
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxReads); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minMapQual); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minBaseQual); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxVariants); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = ((PyObject *)__pyx_f_13variantFilter_getHaplotypesInWindow(__pyx_v_window, __pyx_v_nReadsThisWindow, __pyx_v_refFile, __pyx_t_2, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_v_readBuffers, __pyx_v_options)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allVarHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 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_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_allVarHaplotypes)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = ((PyObject *)__pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_1), __pyx_v_refFile)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 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_5 = ((PyObject *)__pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList(__pyx_v_allUniqueHaplotypes)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "variantcaller.pyx":121
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     if nUniqueHaplotypes <= 1:
 */
  if (unlikely(((PyObject *)__pyx_v_allUniqueHaplotypes) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_allUniqueHaplotypes)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __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_8 = ((__pyx_v_nUniqueHaplotypes <= 1) != 0);
  if (__pyx_t_8) {

    /* "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_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = ((!__pyx_t_8) != 0);
    if (__pyx_t_7) {

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

  /* "variantcaller.pyx":138
 *             return
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     cdef int maxEMIterations = 100
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__nInd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_16, __pyx_t_15, __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 = 100;

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

  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_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;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__chromosome)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __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 bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __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 list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_empty_tuple));
  __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple));
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10chaplotype_Haplotype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_refHaplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3);
  __pyx_t_3 = 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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = ((PyObject *)__pyx_v_readBuffers); __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
    __pyx_v_theReadBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_1);
    __pyx_t_1 = 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));
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_7 = ((__pyx_v_nReadsThisWindow == 0) != 0);
  if (__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    __pyx_t_8 = __pyx_t_9;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  if (__pyx_t_8) {

    /* "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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__verbosity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "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(((PyObject *)__pyx_r));
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "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 = PyInt_FromLong(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "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_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_nReadsThisWindow); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 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(((PyObject *)__pyx_r));
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxReads); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_f_13variantFilter_getHaplotypesInWindow(__pyx_v_window, __pyx_v_nReadsThisWindow, __pyx_v_refFile, __pyx_t_2, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_v_readBuffers, __pyx_v_options)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_allVarHaplotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 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_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_allVarHaplotypes)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_5), __pyx_v_refFile)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 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_4 = ((PyObject *)__pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList(__pyx_v_allUniqueHaplotypes)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "variantcaller.pyx":184
 *     cdef list allGenotypes = generateAllGenotypesFromHaplotypeList(allUniqueHaplotypes)
 * 
 *     cdef int nUniqueHaplotypes = len(allUniqueHaplotypes)             # <<<<<<<<<<<<<<
 * 
 *     if nUniqueHaplotypes <= 1:
 */
  if (unlikely(((PyObject *)__pyx_v_allUniqueHaplotypes) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_allUniqueHaplotypes)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nUniqueHaplotypes = __pyx_t_6;

  /* "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_8 = ((__pyx_v_nUniqueHaplotypes <= 1) != 0);
  if (__pyx_t_8) {

    /* "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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((!__pyx_t_8) != 0);
    if (__pyx_t_7) {

      /* "variantcaller.pyx":190
 *         # reference.
 *         if not options.outputRefCalls:
 *             return []             # <<<<<<<<<<<<<<
 * 
 *     pop.setup(variants, allUniqueHaplotypes, allGenotypes, options.nInd, options.verbosity, readBuffers)
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "variantcaller.pyx":192
 *             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_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_15 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __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_16, __pyx_t_15, __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 = 100;

  /* "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_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_longVars = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 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(((PyObject *)__pyx_v_pop->genotypeCalls) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyList_GET_ITEM(__pyx_v_pop->genotypeCalls, 0);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_gt = ((struct __pyx_obj_9cgenotype_DiploidGenotype *)__pyx_t_4);
  __pyx_t_4 = 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_4 = ((PyObject *)__pyx_v_gt->hap1);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_hap1 = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4);
  __pyx_t_4 = 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_4 = ((PyObject *)__pyx_v_gt->hap2);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_hap2 = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4);
  __pyx_t_4 = 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_4 = PyObject_RichCompare(((PyObject *)__pyx_v_hap1), ((PyObject *)__pyx_v_refHaplotype), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {

    /* "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_4 = ((PyObject *)__pyx_v_hap1->longVar);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_13variantFilter_normaliseVar(((struct __pyx_obj_7variant_Variant *)__pyx_t_4))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_longVars, __pyx_t_5); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "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_5 = PyObject_RichCompare(((PyObject *)__pyx_v_hap2), ((PyObject *)__pyx_v_refHaplotype), Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_7) {
    __pyx_t_5 = PyObject_RichCompare(((PyObject *)__pyx_v_hap1), ((PyObject *)__pyx_v_hap2), Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __pyx_t_8;
  } else {
    __pyx_t_9 = __pyx_t_7;
  }
  if (__pyx_t_9) {

    /* "variantcaller.pyx":205
 *         longVars.append(normaliseVar(hap1.longVar))
 *     if hap2 != refHaplotype and hap1!= hap2:
 *         longVars.append(normaliseVar(hap2.longVar))             # <<<<<<<<<<<<<<
 *     return longVars
 * 
 */
    __pyx_t_5 = ((PyObject *)__pyx_v_hap2->longVar);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = ((PyObject *)__pyx_f_13variantFilter_normaliseVar(((struct __pyx_obj_7variant_Variant *)__pyx_t_5))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_17 = __Pyx_PyList_Append(__pyx_v_longVars, __pyx_t_4); if (unlikely(__pyx_t_17 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

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

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __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;
}

/* 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 = {__Pyx_NAMESTR("countTotalReadsInRegion"), (PyCFunction)__pyx_pw_13variantcaller_1countTotalReadsInRegion, METH_O, __Pyx_DOCSTR(__pyx_doc_13variantcaller_countTotalReadsInRegion)};
static PyObject *__pyx_pw_13variantcaller_1countTotalReadsInRegion(PyObject *__pyx_self, PyObject *__pyx_v_readBuffers) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countTotalReadsInRegion (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_readBuffers), (&PyList_Type), 1, "readBuffers", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_13variantcaller_countTotalReadsInRegion(__pyx_self, ((PyObject*)__pyx_v_readBuffers));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
    __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 = PyInt_FromLong(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->reads)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF(__pyx_v_thisBufferSize);
    __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 = PyInt_FromLong(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->badReads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->badReads)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF(__pyx_v_thisBadBufferSize);
    __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 = PyInt_FromLong(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->reads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->reads)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_totalReads);
    __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 = PyInt_FromLong(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->badReads->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->badReads)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalReads);
    __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 = PyInt_FromLong(((struct __pyx_vtabstruct_7cwindow_ReadArray *)__pyx_v_theReadBuffer->brokenMates->__pyx_vtab)->getSize(__pyx_v_theReadBuffer->brokenMates)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_totalReads);
    __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 = PyInt_FromLong(__pyx_v_theReadBuffer->reads->__pyx___capacity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalBufferSize);
    __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 = PyInt_FromLong(__pyx_v_theReadBuffer->badReads->__pyx___capacity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_totalBufferSize);
    __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 = PyInt_FromLong(__pyx_v_theReadBuffer->brokenMates->__pyx___capacity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalBufferSize);
    __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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_thisBufferSize);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_thisBufferSize);
    __Pyx_GIVEREF(__pyx_v_thisBufferSize);
    __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (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_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_4 = __pyx_t_6(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF(__pyx_v_i);
      __pyx_v_i = __pyx_t_4;
      __pyx_t_4 = 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_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->seq) + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __pyx_v_totalSeqQualSize = __pyx_t_4;
      __pyx_t_4 = 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_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyInt_FromLong((2 * (__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->cigarLen)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_seqQualSize);
      __pyx_v_seqQualSize = __pyx_t_4;
      __pyx_t_4 = 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_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyInt_FromSize_t((strlen((__pyx_v_theReadBuffer->reads->array[__pyx_t_7])->qual) + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_seqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_cigarSize);
      __pyx_v_cigarSize = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_thisBadBufferSize);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_thisBadBufferSize);
    __Pyx_GIVEREF(__pyx_v_thisBadBufferSize);
    __pyx_t_4 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (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_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_3)) {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_4 = __pyx_t_6(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF(__pyx_v_i);
      __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_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PyInt_FromLong((2 * (__pyx_v_theReadBuffer->badReads->array[__pyx_t_7])->cigarLen)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_totalSeqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_seqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_seqQualSize);
      __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_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_cigarSize);
      __pyx_v_cigarSize = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __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_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalSeqQualSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalSeqQualSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_readSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_readSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_totalSeqQualSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_totalSeqQualSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_pointerSize);
    __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_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_pointerSize);
    __pyx_v_pointerSize = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __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_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_seqQualSize);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_seqQualSize);
  __Pyx_GIVEREF(__pyx_v_seqQualSize);
  __Pyx_INCREF(__pyx_v_cigarSize);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_cigarSize);
  __Pyx_GIVEREF(__pyx_v_cigarSize);
  __Pyx_INCREF(__pyx_v_readSize);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_readSize);
  __Pyx_GIVEREF(__pyx_v_readSize);
  __Pyx_INCREF(__pyx_v_pointerSize);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_pointerSize);
  __Pyx_GIVEREF(__pyx_v_pointerSize);
  __Pyx_INCREF(__pyx_v_totalSize);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_v_totalSize);
  __Pyx_GIVEREF(__pyx_v_totalSize);
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_totalReads);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_totalReads);
  __Pyx_GIVEREF(__pyx_v_totalReads);
  __Pyx_INCREF(__pyx_v_totalBufferSize);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_totalBufferSize);
  __Pyx_GIVEREF(__pyx_v_totalBufferSize);
  __Pyx_INCREF(__pyx_v_totalSeqQualSize);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_totalSeqQualSize);
  __Pyx_GIVEREF(__pyx_v_totalSeqQualSize);
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
    __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);
  }
  __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_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __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;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
    __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;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_readsThisSample); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_totalAlignmentGaps); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyFloat_FromDouble((__pyx_v_totalAlignmentGaps / __pyx_v_readsThisSample)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_4 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_10));
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_10));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__info); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_6 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_readsThisSample); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_nImproperReads); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyFloat_FromDouble((__pyx_v_nImproperReads / (__pyx_v_readsThisSample + __pyx_v_badReadsThisSample))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_10 = 0;
      __pyx_t_6 = 0;
      __pyx_t_9 = 0;
      __pyx_t_8 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_7));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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;
      goto __pyx_L10;
    }
    __pyx_L10:;
    __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;

  __pyx_r = 0;
  goto __pyx_L0;
  __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_WriteUnraisable("variantcaller.doWeNeedToAssembleThisRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __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;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mergeHaplotypes", 0);

  /* "variantcaller.pyx":331
 *     possible.
 *     """
 *     cdef list sortedHaps = sorted(haplotypes)             # <<<<<<<<<<<<<<
 *     cdef list mergedHaplotypes = []
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_haplotypes));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_haplotypes));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_haplotypes));
  __pyx_t_2 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_sortedHaps = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "variantcaller.pyx":332
 *     """
 *     cdef list sortedHaps = sorted(haplotypes)
 *     cdef list mergedHaplotypes = []             # <<<<<<<<<<<<<<
 * 
 *     cdef Haplotype hap = None
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_mergedHaplotypes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 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(((PyObject *)__pyx_v_sortedHaps) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = ((PyObject *)__pyx_v_sortedHaps); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10chaplotype_Haplotype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_hap));
    __pyx_v_hap = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1);
    __pyx_t_1 = 0;

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

      /* "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(((PyObject *)__pyx_v_lastHap));
      __pyx_v_lastHap = __pyx_v_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_1 = PyObject_RichCompare(((PyObject *)__pyx_v_hap), ((PyObject *)__pyx_v_lastHap), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "variantcaller.pyx":351
 *         elif hap == lastHap:
 * 
 *             logger.debug("Merging haplotypes %s and %s" %(hap, lastHap))             # <<<<<<<<<<<<<<
 * 
 *             # Take the haplotype with the set of variants
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__debug); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_hap));
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_hap));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_hap));
      __Pyx_INCREF(((PyObject *)__pyx_v_lastHap));
      PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_lastHap));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_lastHap));
      __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_7));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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(((PyObject *)__pyx_v_lastHap->variants) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = ((PyObject *)__pyx_v_lastHap->variants); __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7variant_Variant))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF(((PyObject *)__pyx_v_theVar));
        __pyx_v_theVar = ((struct __pyx_obj_7variant_Variant *)__pyx_t_1);
        __pyx_t_1 = 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));
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "variantcaller.pyx":361
 *                 priorOne *= theVar.calculatePrior(refFile)
 * 
 *             for theVar in hap.variants:             # <<<<<<<<<<<<<<
 *                 priorTwo *= theVar.calculatePrior(refFile)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_hap->variants) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = ((PyObject *)__pyx_v_hap->variants); __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7variant_Variant))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF(((PyObject *)__pyx_v_theVar));
        __pyx_v_theVar = ((struct __pyx_obj_7variant_Variant *)__pyx_t_1);
        __pyx_t_1 = 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));
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

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

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

        /* "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(((PyObject *)__pyx_v_lastHap));
        __pyx_v_lastHap = __pyx_v_hap;
        goto __pyx_L10;
      }
      /*else*/ {
      }
      __pyx_L10:;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "variantcaller.pyx":378
 *         # Add whichever hap we kept to merged list
 *         else:
 *             mergedHaplotypes.append(lastHap)             # <<<<<<<<<<<<<<
 *             lastHap = hap
 * 
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_mergedHaplotypes, ((PyObject *)__pyx_v_lastHap)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_lastHap));
      __pyx_v_lastHap = __pyx_v_hap;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

    /* "variantcaller.pyx":382
 * 
 *     if lastHap is not None:
 *         mergedHaplotypes.append(lastHap)             # <<<<<<<<<<<<<<
 * 
 *     #logger.debug("")
 */
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_mergedHaplotypes, ((PyObject *)__pyx_v_lastHap)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

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

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __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;
  long __pyx_t_21;
  PyObject *(*__pyx_t_22)(PyObject *);
  PY_LONG_LONG __pyx_t_23;
  PY_LONG_LONG __pyx_t_24;
  int __pyx_t_25;
  int __pyx_t_26;
  int __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __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 = ((PyObject *)((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_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __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
 */
  __pyx_t_2 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_refSequenceBytes)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __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_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_readBuffers));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_readBuffers));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_readBuffers));
    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      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_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_totalReadsInRegion = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_totalBufferSizeInRegion = __pyx_t_5;
    __pyx_t_5 = 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_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_totalReadsInRegion);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_totalReadsInRegion);
    __Pyx_GIVEREF(__pyx_v_totalReadsInRegion);
    __Pyx_INCREF(__pyx_v_totalBufferSizeInRegion);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_totalBufferSizeInRegion);
    __Pyx_GIVEREF(__pyx_v_totalBufferSizeInRegion);
    __Pyx_INCREF(__pyx_v_totalSeqQualSize);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_totalSeqQualSize);
    __Pyx_GIVEREF(__pyx_v_totalSeqQualSize);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_7 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "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_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minMapQual); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minFlank); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minBaseQual); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxReads); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = PyInt_FromLong(__pyx_v_maxReadLength); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(11); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_8));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
    __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
    PyTuple_SET_ITEM(__pyx_t_15, 1, ((PyObject *)__pyx_v_refFile));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_15, 8, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_15, 9, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_15, 10, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __pyx_t_8 = 0;
    __pyx_t_1 = 0;
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7variant_VariantCandidateGenerator)), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(((PyObject *)__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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_14 = ((PyObject *)__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_COMPILING_IN_CPYTHON
      __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_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_theReadBuffer));
      __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 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_13 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13);
      __Pyx_GIVEREF(__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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxReads); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyInt_FromLong(__pyx_v_maxReadLength); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__verbosity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__genSNPs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__genIndels); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_17 = PyTuple_New(11); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_t_12));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_12));
      __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
      PyTuple_SET_ITEM(__pyx_t_17, 1, ((PyObject *)__pyx_v_refFile));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
      PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_17, 5, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_17, 6, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_17, 7, __pyx_v_options);
      __Pyx_GIVEREF(__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_17, 8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_17, 9, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_17, 10, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      __pyx_t_15 = 0;
      __pyx_t_11 = 0;
      __pyx_t_9 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7variant_VariantCandidateGenerator)), ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
      __Pyx_XDECREF(((PyObject *)__pyx_v_varCandGen));
      __pyx_v_varCandGen = ((struct __pyx_obj_7variant_VariantCandidateGenerator *)__pyx_t_8);
      __pyx_t_8 = 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);
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__verbosity); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_17 = PyObject_RichCompare(__pyx_t_8, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __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_t_17 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s__debug); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = ((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_18 = PyDict_Size(__pyx_t_17); if (unlikely(__pyx_t_18 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = PyInt_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_theReadBuffer->sample));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_theReadBuffer->sample));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_theReadBuffer->sample));
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_17);
        __Pyx_GIVEREF(__pyx_t_17);
        __pyx_t_17 = 0;
        __pyx_t_17 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_17));
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_17));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
        __pyx_t_17 = 0;
        __pyx_t_17 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;

      /* "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(((PyObject *)__pyx_v_varCandGen->variantHeap) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_dict_iterator(((PyObject *)__pyx_v_varCandGen->variantHeap), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_19), (&__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_17);
      __pyx_t_17 = __pyx_t_1;
      __pyx_t_1 = 0;
      while (1) {
        __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_17, __pyx_t_19, &__pyx_t_18, &__pyx_t_1, &__pyx_t_8, NULL, __pyx_t_3);
        if (unlikely(__pyx_t_20 == 0)) break;
        if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_8);
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7variant_Variant))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF(__pyx_v_key);
        __pyx_v_key = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_XDECREF(((PyObject *)__pyx_v_v));
        __pyx_v_v = ((struct __pyx_obj_7variant_Variant *)__pyx_t_8);
        __pyx_t_8 = 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);
          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);
          goto __pyx_L13;
        }
        /*else*/ {

          /* "variantcaller.pyx":468
 *                     allSampleVarCandGen.addVariantToList(v)
 *                 else:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *             if options.verbosity >= 3:
 */
          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_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_17, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__debug); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = ((PyObject *)__pyx_v_varCandGen->variantHeap);
        __Pyx_INCREF(__pyx_t_8);
        if (unlikely(__pyx_t_8 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_19 = PyDict_Size(__pyx_t_8); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L14;
      }
      __pyx_L14:;
    }
    __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 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rawBamVariants), __pyx_n_s__extend); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7variant_VariantCandidateGenerator *)__pyx_v_allSampleVarCandGen->__pyx_vtab)->getCandidates(__pyx_v_allSampleVarCandGen, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1 = PyInt_FromLong(__pyx_v_longestRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_14 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_GE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = PyInt_FromLong(__pyx_v_longestRead); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_14 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_17)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
        __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_t_1));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s__rlen, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "variantcaller.pyx":486
 *                 options.rlen = options.maxSize
 *             else:
 *                 options.rlen = longestRead             # <<<<<<<<<<<<<<
 * 
 *     maxReadLength = options.rlen
 */
        __pyx_t_1 = PyInt_FromLong(__pyx_v_longestRead); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s__rlen, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __pyx_L16:;
      goto __pyx_L15;
    }
    __pyx_L15:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "variantcaller.pyx":488
 *                 options.rlen = longestRead
 * 
 *     maxReadLength = options.rlen             # <<<<<<<<<<<<<<
 * 
 *     # Get variants from external VCF source file
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__sourceFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__variantutils); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_23); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__sourceFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __pyx_v_variantSource = __pyx_t_1;
    __pyx_t_1 = 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_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vcfFileVariants), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_variantSource, __pyx_n_s__Variants); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_17 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_14 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_17);
    __Pyx_GIVEREF(__pyx_t_17);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __pyx_t_17 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "variantcaller.pyx":496
 * 
 *     # Get variants from assembler
 *     if options.assemble:             # <<<<<<<<<<<<<<
 * 
 *         assemRegionShift = max(100, min(1000, options.assemblyRegionSize//2))
 */
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemble); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblyRegionSize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = PyNumber_FloorDivide(__pyx_t_14, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_21 = 1000;
    __pyx_t_1 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_14 = __pyx_t_5;
    } else {
      __pyx_t_8 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_14 = __pyx_t_8;
      __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_14);
    __pyx_t_5 = __pyx_t_14;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_21 = 100;
    __pyx_t_8 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_14 = __pyx_t_5;
    } else {
      __pyx_t_1 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_t_14;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_v_assemRegionShift = __pyx_t_5;
    __pyx_t_5 = 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_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__debug); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_v_assemRegionShift); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_5 = __pyx_int_0;
    __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    __Pyx_INCREF(__pyx_v_assemRegionShift);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_assemRegionShift);
    __Pyx_GIVEREF(__pyx_v_assemRegionShift);
    __pyx_t_1 = 0;
    __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    if (PyList_CheckExact(__pyx_t_14) || PyTuple_CheckExact(__pyx_t_14)) {
      __pyx_t_8 = __pyx_t_14; __Pyx_INCREF(__pyx_t_8); __pyx_t_16 = 0;
      __pyx_t_22 = NULL;
    } else {
      __pyx_t_16 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_22 = Py_TYPE(__pyx_t_8)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    for (;;) {
      if (!__pyx_t_22 && PyList_CheckExact(__pyx_t_8)) {
        if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_14 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_14); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_22 && PyTuple_CheckExact(__pyx_t_8)) {
        if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_16); __Pyx_INCREF(__pyx_t_14); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_14 = __pyx_t_22(__pyx_t_8);
        if (unlikely(!__pyx_t_14)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_14);
      }
      __Pyx_XDECREF(__pyx_v_assemStart);
      __pyx_v_assemStart = __pyx_t_14;
      __pyx_t_14 = 0;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_v_assemIndex);
      __pyx_v_assemIndex = __pyx_t_5;
      __pyx_t_14 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_14;
      __pyx_t_14 = 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_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblyRegionSize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_1 = PyNumber_Add(__pyx_v_assemStart, __pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_17 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_17, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_6) {
        __pyx_t_7 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_14 = __pyx_t_1;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_14;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_v_assemEnd);
      __pyx_v_assemEnd = __pyx_t_1;
      __pyx_t_1 = 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblyRegionSize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = PyNumber_Subtract(__pyx_v_assemStart, __pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_21 = 0;
      __pyx_t_7 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_17 = PyObject_RichCompare(__pyx_t_14, __pyx_t_7, Py_GT); __Pyx_XGOTREF(__pyx_t_17); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (__pyx_t_6) {
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_1 = __pyx_t_14;
      } else {
        __pyx_t_17 = PyInt_FromLong(__pyx_t_21); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_1 = __pyx_t_17;
        __pyx_t_17 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __pyx_t_1;
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_v_refStart);
      __pyx_v_refStart = __pyx_t_14;
      __pyx_t_14 = 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_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblyRegionSize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_1 = PyNumber_Add(__pyx_v_assemEnd, __pyx_t_14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_v_refEnd);
      __pyx_v_refEnd = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "variantcaller.pyx":509
 *             refStart = max(0, assemStart-options.assemblyRegionSize)
 *             refEnd = assemEnd+options.assemblyRegionSize
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)             # <<<<<<<<<<<<<<
 *             refSequence = refSequenceBytes
 * 
 */
      __pyx_t_23 = __Pyx_PyInt_AsLongLong(__pyx_v_refStart); if (unlikely((__pyx_t_23 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_24 = __Pyx_PyInt_AsLongLong(__pyx_v_refEnd); if (unlikely((__pyx_t_24 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_t_23, __pyx_t_24)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_v_refSequenceBytes));
      __pyx_v_refSequenceBytes = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "variantcaller.pyx":510
 *             refEnd = assemEnd+options.assemblyRegionSize
 *             refSequenceBytes = refFile.getSequence(chrom, refStart, refEnd)
 *             refSequence = refSequenceBytes             # <<<<<<<<<<<<<<
 * 
 *             needToAssemble = doWeNeedToAssembleThisRegion(readBuffers, chrom, assemStart, assemEnd, options, refSequence)
 */
      __pyx_t_2 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_refSequenceBytes)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __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_AsInt(__pyx_v_assemStart); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_assemEnd); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __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;
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "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))
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_assemblerVariants), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_chrom)); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_20 = __Pyx_PyInt_AsInt(__pyx_v_assemStart); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_v_assemEnd); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_25 = __Pyx_PyInt_AsInt(__pyx_v_refStart); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_26 = __Pyx_PyInt_AsInt(__pyx_v_refEnd); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_14 = ((PyObject *)__pyx_f_9assembler_assembleReadsAndDetectVariants(__pyx_t_2, __pyx_t_20, __pyx_t_3, __pyx_t_25, __pyx_t_26, __pyx_v_readBuffers, __pyx_v_refSequence, __pyx_v_options)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_L19_continue:;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "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_5 = PyNumber_Add(((PyObject *)__pyx_v_rawBamVariants), ((PyObject *)__pyx_v_vcfFileVariants)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_v_assemblerVariants)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_allVarCands = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 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_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = ((PyObject *)__pyx_v_allVarCands); __Pyx_INCREF(__pyx_t_14); __pyx_t_16 = 0;
  for (;;) {
    if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_14)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_17 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_17); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_17 = PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_17) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_17, __pyx_ptype_7variant_Variant))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_v));
    __pyx_v_v = ((struct __pyx_obj_7variant_Variant *)__pyx_t_17);
    __pyx_t_17 = 0;
    __pyx_t_17 = ((PyObject *)__pyx_f_13platypusutils_leftNormaliseIndel(__pyx_v_v, __pyx_v_refFile, __pyx_v_maxReadLength)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_17))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  }
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_8 = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_27 = PyList_Sort(((PyObject *)__pyx_t_8)); if (unlikely(__pyx_t_27 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_leftNormVars = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__minReads); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_26 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_25 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__verbosity); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_8); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = ((PyObject *)__pyx_f_13variantFilter_filterVariants(__pyx_v_leftNormVars, __pyx_v_refFile, __pyx_v_maxReadLength, __pyx_t_26, __pyx_t_25, __pyx_t_3, __pyx_v_options)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_filteredVariants = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 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_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(((PyObject *)__pyx_v_filteredVariants) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_16 = PyList_GET_SIZE(((PyObject *)__pyx_v_filteredVariants)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_14 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_17 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_8 = 0;
  __pyx_t_14 = 0;
  __pyx_t_17 = 0;
  __pyx_t_17 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_17));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_17));
  __pyx_t_17 = 0;
  __pyx_t_17 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 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(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_filteredVariants));
  __pyx_r = __pyx_v_filteredVariants;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_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;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  int __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  PyObject *(*__pyx_t_27)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsLongLong(__pyx_t_2); if (unlikely((__pyx_t_4 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsLongLong(__pyx_t_3); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_refFile->refs) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_refFile->refs), ((PyObject *)__pyx_v_chrom)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_refFile->refs) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_refFile->refs), ((PyObject *)__pyx_v_chrom)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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_AsLongLong(__pyx_t_6); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = ((PyObject *)((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_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __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
 */
  __pyx_t_8 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_refSequenceBytes)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __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_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 list, got %.200s", Py_TYPE(__pyx_v_bamFiles)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_t_6 = ((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_readBuffers = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __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 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    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_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __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_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__error); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_14 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_3 = 0;
      __pyx_t_14 = 0;
      __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_14));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
      __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_13 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_14 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_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_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    __pyx_L10_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_16 = (__pyx_t_7 != 0);
  if (__pyx_t_16) {

    /* "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_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "variantcaller.pyx":561
 *         return
 * 
 *     cdef list allSortedVariants = generateVariantsInRegion(chrom, start, end, bamFiles, refFile, options, windowGenerator, outputFile, vcf, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *     cdef Variant var,nextVar
 */
  __pyx_t_6 = ((PyObject *)__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_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_v_allSortedVariants = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 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_6 = __pyx_int_0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_windowGenerator, __pyx_n_s__WindowsAndVariants); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyLong_FromLongLong(__pyx_v_maxContigPos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_15 = PyTuple_New(6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_allSortedVariants));
  PyTuple_SET_ITEM(__pyx_t_15, 4, ((PyObject *)__pyx_v_allSortedVariants));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_allSortedVariants));
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_15 = __pyx_t_3; __Pyx_INCREF(__pyx_t_15); __pyx_t_17 = 0;
    __pyx_t_18 = NULL;
  } else {
    __pyx_t_17 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_18 = Py_TYPE(__pyx_t_15)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (!__pyx_t_18 && PyList_CheckExact(__pyx_t_15)) {
      if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_15)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_18 && PyTuple_CheckExact(__pyx_t_15)) {
      if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_3 = __pyx_t_18(__pyx_t_15);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_window));
    __pyx_v_window = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_windowIndex);
    __pyx_v_windowIndex = __pyx_t_6;
    __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6);
    __pyx_t_6 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "variantcaller.pyx":568
 *     for windowIndex,window in enumerate(windowGenerator.WindowsAndVariants(chrom, start, end, maxContigPos, allSortedVariants, options)):
 * 
 *         try:             # <<<<<<<<<<<<<<
 * 
 *             chrom = window['chromosome']
 */
    {
      __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(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__chromosome)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_chrom));
        __pyx_v_chrom = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "variantcaller.pyx":571
 * 
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *             windowEnd = window['endPos']
 * 
 */
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_windowStart);
        __pyx_v_windowStart = __pyx_t_3;
        __pyx_t_3 = 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(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_windowEnd);
        __pyx_v_windowEnd = __pyx_t_3;
        __pyx_t_3 = 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_3 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_13, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_16) {
          if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          }
          __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_19 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_7 = (__pyx_t_19 > 0);
          __pyx_t_20 = __pyx_t_7;
        } else {
          __pyx_t_20 = __pyx_t_16;
        }
        if (__pyx_t_20) {

          /* "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_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
          PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chrom));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
          __Pyx_INCREF(__pyx_v_windowStart);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_windowStart);
          __Pyx_GIVEREF(__pyx_v_windowStart);
          __Pyx_INCREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_3);
          __pyx_t_2 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_3));
          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
          __pyx_t_3 = 0;
          __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_L22_try_continue;
          goto __pyx_L24;
        }
        __pyx_L24:;

        /* "variantcaller.pyx":578
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 callVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 * 
 */
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_19 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_20 = ((__pyx_t_19 > 0) != 0);
        if (__pyx_t_20) {

          /* "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_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          goto __pyx_L25;
        }
        __pyx_L25:;

        /* "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(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_19 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_20 = ((__pyx_t_19 > 0) != 0);
        if (__pyx_t_20) {
          if (unlikely(((PyObject *)__pyx_v_pop->variantPosteriors) == Py_None)) {
            PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          }
          __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_pop->variantPosteriors); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_19 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_16 = ((__pyx_t_19 > 0) != 0);
          __pyx_t_7 = __pyx_t_16;
        } else {
          __pyx_t_7 = __pyx_t_20;
        }
        if (__pyx_t_7) {

          /* "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_3 = ((PyObject *)__pyx_v_pop->varsByPos);
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_1 = ((PyObject *)__pyx_v_pop->vcfInfo);
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_13 = ((PyObject *)__pyx_v_pop->vcfFilter);
          __Pyx_INCREF(__pyx_t_13);
          __pyx_t_2 = ((PyObject *)__pyx_v_pop->haplotypes);
          __Pyx_INCREF(__pyx_t_2);
          __pyx_t_14 = ((PyObject *)__pyx_v_pop->genotypes);
          __Pyx_INCREF(__pyx_t_14);
          __pyx_t_21 = ((PyObject *)__pyx_v_pop->readBuffers);
          __Pyx_INCREF(__pyx_t_21);
          __pyx_t_22 = ((PyObject *)__pyx_v_pop->variants);
          __Pyx_INCREF(__pyx_t_22);
          if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          }
          __pyx_t_23 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_23);
          __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_23); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
          if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          }
          __pyx_t_23 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_23);
          __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_t_23); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
          __pyx_f_8vcfutils_outputCallToVCF(((PyObject*)__pyx_t_3), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_13), ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_14), __pyx_v_pop->frequencies, __pyx_v_pop->genotypeLikelihoods, __pyx_v_pop->goodnessOfFitValues, __pyx_v_pop->haplotypeIndexes, ((PyObject*)__pyx_t_21), __pyx_v_pop->nIndividuals, __pyx_v_vcf, __pyx_v_refFile, __pyx_v_outputFile, __pyx_v_options, ((PyObject*)__pyx_t_22), __pyx_t_12, __pyx_t_24);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 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_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (__pyx_t_7) {
            if (unlikely(((PyObject *)__pyx_v_pop->varsByPos) == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys");
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            }
            __pyx_t_22 = __Pyx_PyDict_Keys(__pyx_v_pop->varsByPos); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_22);
            __pyx_t_19 = PyObject_Length(__pyx_t_22); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            __pyx_t_20 = (__pyx_t_19 > 1);
            __pyx_t_16 = __pyx_t_20;
          } else {
            __pyx_t_16 = __pyx_t_7;
          }
          if (__pyx_t_16) {

            /* "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(__pyx_v_lastPos);
            __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(__pyx_v_lastVars);
            __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_22 = __pyx_int_0;
            __pyx_t_19 = 0;
            if (unlikely(((PyObject *)__pyx_v_pop->varsByPos) == Py_None)) {
              PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems");
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            }
            __pyx_t_14 = __Pyx_dict_iterator(((PyObject *)__pyx_v_pop->varsByPos), 1, ((PyObject *)__pyx_n_s__iteritems), (&__pyx_t_25), (&__pyx_t_24)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_XDECREF(__pyx_t_21);
            __pyx_t_21 = __pyx_t_14;
            __pyx_t_14 = 0;
            while (1) {
              __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_21, __pyx_t_25, &__pyx_t_19, &__pyx_t_14, &__pyx_t_2, NULL, __pyx_t_24);
              if (unlikely(__pyx_t_12 == 0)) break;
              if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_XDECREF(__pyx_v_pos);
              __pyx_v_pos = __pyx_t_14;
              __pyx_t_14 = 0;
              __Pyx_XDECREF(__pyx_v_theseVars);
              __pyx_v_theseVars = __pyx_t_2;
              __pyx_t_2 = 0;
              __Pyx_INCREF(__pyx_t_22);
              __Pyx_XDECREF(__pyx_v_index);
              __pyx_v_index = __pyx_t_22;
              __pyx_t_2 = PyNumber_Add(__pyx_t_22, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_22);
              __pyx_t_22 = __pyx_t_2;
              __pyx_t_2 = 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_2 = PyObject_RichCompare(__pyx_v_index, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              if (__pyx_t_16) {

                /* "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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_2);
                if (PyList_CheckExact(__pyx_v_lastVars) || PyTuple_CheckExact(__pyx_v_lastVars)) {
                  __pyx_t_14 = __pyx_v_lastVars; __Pyx_INCREF(__pyx_t_14); __pyx_t_26 = 0;
                  __pyx_t_27 = NULL;
                } else {
                  __pyx_t_26 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_lastVars); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_27 = Py_TYPE(__pyx_t_14)->tp_iternext;
                }
                for (;;) {
                  if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_14)) {
                    if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_14)) break;
                    #if CYTHON_COMPILING_IN_CPYTHON
                    __pyx_t_13 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_26); __Pyx_INCREF(__pyx_t_13); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #else
                    __pyx_t_13 = PySequence_ITEM(__pyx_t_14, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #endif
                  } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_14)) {
                    if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
                    #if CYTHON_COMPILING_IN_CPYTHON
                    __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_26); __Pyx_INCREF(__pyx_t_13); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #else
                    __pyx_t_13 = PySequence_ITEM(__pyx_t_14, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #endif
                  } else {
                    __pyx_t_13 = __pyx_t_27(__pyx_t_14);
                    if (unlikely(!__pyx_t_13)) {
                      if (PyErr_Occurred()) {
                        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                        else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_13);
                  }
                  __Pyx_XDECREF(__pyx_v_v);
                  __pyx_v_v = __pyx_t_13;
                  __pyx_t_13 = 0;
                  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s__maxRefPos); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_13);
                  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_13))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                }
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_14);
                PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_2));
                __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
                __pyx_t_2 = 0;
                __pyx_t_2 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
                __Pyx_XDECREF(__pyx_v_lastVarPos);
                __pyx_v_lastVarPos = __pyx_t_2;
                __pyx_t_2 = 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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_2);
                if (PyList_CheckExact(__pyx_v_theseVars) || PyTuple_CheckExact(__pyx_v_theseVars)) {
                  __pyx_t_14 = __pyx_v_theseVars; __Pyx_INCREF(__pyx_t_14); __pyx_t_26 = 0;
                  __pyx_t_27 = NULL;
                } else {
                  __pyx_t_26 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_v_theseVars); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_27 = Py_TYPE(__pyx_t_14)->tp_iternext;
                }
                for (;;) {
                  if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_14)) {
                    if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_14)) break;
                    #if CYTHON_COMPILING_IN_CPYTHON
                    __pyx_t_13 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_26); __Pyx_INCREF(__pyx_t_13); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #else
                    __pyx_t_13 = PySequence_ITEM(__pyx_t_14, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #endif
                  } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_14)) {
                    if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
                    #if CYTHON_COMPILING_IN_CPYTHON
                    __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_26); __Pyx_INCREF(__pyx_t_13); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #else
                    __pyx_t_13 = PySequence_ITEM(__pyx_t_14, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    #endif
                  } else {
                    __pyx_t_13 = __pyx_t_27(__pyx_t_14);
                    if (unlikely(!__pyx_t_13)) {
                      if (PyErr_Occurred()) {
                        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                        else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      }
                      break;
                    }
                    __Pyx_GOTREF(__pyx_t_13);
                  }
                  __Pyx_XDECREF(__pyx_v_v);
                  __pyx_v_v = __pyx_t_13;
                  __pyx_t_13 = 0;
                  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s__minRefPos); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_13);
                  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_13))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                }
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_14);
                PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_2));
                __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
                __pyx_t_2 = 0;
                __pyx_t_2 = PyObject_Call(__pyx_builtin_min, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_2);
                __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
                __pyx_t_14 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_XDECREF(__pyx_v_nextVarPos);
                __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_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_GOTREF(__pyx_t_14);
                __pyx_t_2 = PyObject_RichCompare(__pyx_t_14, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                if (__pyx_t_16) {

                  /* "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_2 = PyNumber_Add(__pyx_v_lastVarPos, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_2);
                  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refCallBlockSize); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_14);
                  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_13);
                  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
                  __Pyx_GIVEREF(__pyx_t_2);
                  __Pyx_INCREF(__pyx_v_nextVarPos);
                  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_nextVarPos);
                  __Pyx_GIVEREF(__pyx_v_nextVarPos);
                  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_14);
                  __Pyx_GIVEREF(__pyx_t_14);
                  __pyx_t_2 = 0;
                  __pyx_t_14 = 0;
                  __pyx_t_14 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                  __Pyx_GOTREF(__pyx_t_14);
                  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
                  if (PyList_CheckExact(__pyx_t_14) || PyTuple_CheckExact(__pyx_t_14)) {
                    __pyx_t_13 = __pyx_t_14; __Pyx_INCREF(__pyx_t_13); __pyx_t_26 = 0;
                    __pyx_t_27 = NULL;
                  } else {
                    __pyx_t_26 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_13);
                    __pyx_t_27 = Py_TYPE(__pyx_t_13)->tp_iternext;
                  }
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  for (;;) {
                    if (!__pyx_t_27 && PyList_CheckExact(__pyx_t_13)) {
                      if (__pyx_t_26 >= PyList_GET_SIZE(__pyx_t_13)) break;
                      #if CYTHON_COMPILING_IN_CPYTHON
                      __pyx_t_14 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      #else
                      __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      #endif
                    } else if (!__pyx_t_27 && PyTuple_CheckExact(__pyx_t_13)) {
                      if (__pyx_t_26 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
                      #if CYTHON_COMPILING_IN_CPYTHON
                      __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_26); __Pyx_INCREF(__pyx_t_14); __pyx_t_26++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      #else
                      __pyx_t_14 = PySequence_ITEM(__pyx_t_13, __pyx_t_26); __pyx_t_26++; if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                      #endif
                    } else {
                      __pyx_t_14 = __pyx_t_27(__pyx_t_13);
                      if (unlikely(!__pyx_t_14)) {
                        if (PyErr_Occurred()) {
                          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
                          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                        }
                        break;
                      }
                      __Pyx_GOTREF(__pyx_t_14);
                    }
                    __Pyx_XDECREF(__pyx_v_refBlockStart);
                    __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 = PyNumber_Subtract(__pyx_v_nextVarPos, __pyx_int_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_14);
                    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refCallBlockSize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_2);
                    __pyx_t_1 = PyNumber_Add(__pyx_v_refBlockStart, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_1);
                    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                    __pyx_t_3 = PyObject_RichCompare(__pyx_t_14, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
                    if (__pyx_t_16) {
                      __Pyx_INCREF(__pyx_t_14);
                      __pyx_t_2 = __pyx_t_14;
                    } else {
                      __Pyx_INCREF(__pyx_t_1);
                      __pyx_t_2 = __pyx_t_1;
                    }
                    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __pyx_t_14 = __pyx_t_2;
                    __Pyx_INCREF(__pyx_t_14);
                    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
                    __Pyx_XDECREF(__pyx_v_refBlockEnd);
                    __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_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    if (__pyx_t_16) {

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

                    /* "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 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
                    if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__chromosome), ((PyObject *)__pyx_v_chrom)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__startPos), __pyx_v_refBlockStart) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__endPos), __pyx_v_refBlockEnd) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_2);
                    if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__variants), ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
                    if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__nVar), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_XDECREF(((PyObject *)__pyx_v_thisWindow));
                    __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_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__outputRefCall); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_14);
                    __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_2);
                    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
                    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_chrom));
                    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
                    __Pyx_INCREF(((PyObject *)__pyx_v_pop));
                    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_pop));
                    __Pyx_GIVEREF(((PyObject *)__pyx_v_pop));
                    __Pyx_INCREF(__pyx_v_vcf);
                    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_vcf);
                    __Pyx_GIVEREF(__pyx_v_vcf);
                    __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
                    PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_refFile));
                    __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
                    __Pyx_INCREF(__pyx_v_outputFile);
                    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_outputFile);
                    __Pyx_GIVEREF(__pyx_v_outputFile);
                    __Pyx_INCREF(__pyx_v_windowIndex);
                    PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_windowIndex);
                    __Pyx_GIVEREF(__pyx_v_windowIndex);
                    __Pyx_INCREF(((PyObject *)__pyx_v_thisWindow));
                    PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_thisWindow));
                    __Pyx_GIVEREF(((PyObject *)__pyx_v_thisWindow));
                    __Pyx_INCREF(__pyx_v_options);
                    PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_v_options);
                    __Pyx_GIVEREF(__pyx_v_options);
                    __Pyx_INCREF(((PyObject *)__pyx_v_readBuffers));
                    PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_readBuffers));
                    __Pyx_GIVEREF(((PyObject *)__pyx_v_readBuffers));
                    __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
                    __Pyx_GOTREF(__pyx_t_1);
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
                    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
                    __pyx_L36_continue:;
                  }
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  goto __pyx_L35;
                }
                __pyx_L35:;
                goto __pyx_L30;
              }
              __pyx_L30:;

              /* "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(__pyx_v_lastPos);
              __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(__pyx_v_lastVars);
              __pyx_v_lastVars = __pyx_v_theseVars;
            }
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            goto __pyx_L27;
          }
          __pyx_L27:;
          goto __pyx_L26;
        }
        /*else*/ {

          /* "variantcaller.pyx":606
 *                         lastVars = theseVars
 *             else:
 *                 if options.outputRefCalls:             # <<<<<<<<<<<<<<
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)
 * 
 */
          __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__outputRefCalls); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_22); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          if (__pyx_t_16) {

            /* "variantcaller.pyx":607
 *             else:
 *                 if options.outputRefCalls:
 *                     outputRefCall(chrom, pop, vcf, refFile, outputFile, windowIndex, window, options, readBuffers)             # <<<<<<<<<<<<<<
 * 
 *             if options.compressReads:
 */
            __pyx_t_22 = __Pyx_GetModuleGlobalName(__pyx_n_s__outputRefCall); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_22);
            __pyx_t_21 = PyTuple_New(9); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_21);
            __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
            PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)__pyx_v_chrom));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
            __Pyx_INCREF(((PyObject *)__pyx_v_pop));
            PyTuple_SET_ITEM(__pyx_t_21, 1, ((PyObject *)__pyx_v_pop));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_pop));
            __Pyx_INCREF(__pyx_v_vcf);
            PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_vcf);
            __Pyx_GIVEREF(__pyx_v_vcf);
            __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
            PyTuple_SET_ITEM(__pyx_t_21, 3, ((PyObject *)__pyx_v_refFile));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
            __Pyx_INCREF(__pyx_v_outputFile);
            PyTuple_SET_ITEM(__pyx_t_21, 4, __pyx_v_outputFile);
            __Pyx_GIVEREF(__pyx_v_outputFile);
            __Pyx_INCREF(__pyx_v_windowIndex);
            PyTuple_SET_ITEM(__pyx_t_21, 5, __pyx_v_windowIndex);
            __Pyx_GIVEREF(__pyx_v_windowIndex);
            __Pyx_INCREF(((PyObject *)__pyx_v_window));
            PyTuple_SET_ITEM(__pyx_t_21, 6, ((PyObject *)__pyx_v_window));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_window));
            __Pyx_INCREF(__pyx_v_options);
            PyTuple_SET_ITEM(__pyx_t_21, 7, __pyx_v_options);
            __Pyx_GIVEREF(__pyx_v_options);
            __Pyx_INCREF(((PyObject *)__pyx_v_readBuffers));
            PyTuple_SET_ITEM(__pyx_t_21, 8, ((PyObject *)__pyx_v_readBuffers));
            __Pyx_GIVEREF(((PyObject *)__pyx_v_readBuffers));
            __pyx_t_13 = PyObject_Call(__pyx_t_22, ((PyObject *)__pyx_t_21), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
            __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            goto __pyx_L39;
          }
          __pyx_L39:;
        }
        __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_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__compressReads); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (__pyx_t_16) {

          /* "variantcaller.pyx":610
 * 
 *             if options.compressReads:
 *                 for readBuffer in readBuffers:             # <<<<<<<<<<<<<<
 *                     readBuffer.recompressReadsInCurrentWindow(start, end, refSequence, options.qualBinSize, options.compressReads)
 * 
 */
          if (unlikely(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
          }
          __pyx_t_13 = ((PyObject *)__pyx_v_readBuffers); __Pyx_INCREF(__pyx_t_13); __pyx_t_25 = 0;
          for (;;) {
            if (__pyx_t_25 >= PyList_GET_SIZE(__pyx_t_13)) break;
            #if CYTHON_COMPILING_IN_CPYTHON
            __pyx_t_21 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_25); __Pyx_INCREF(__pyx_t_21); __pyx_t_25++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            #else
            __pyx_t_21 = PySequence_ITEM(__pyx_t_13, __pyx_t_25); __pyx_t_25++; if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            #endif
            if (!(likely(((__pyx_t_21) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_21, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_XDECREF(((PyObject *)__pyx_v_readBuffer));
            __pyx_v_readBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_21);
            __pyx_t_21 = 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_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__qualBinSize); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_21);
            __pyx_t_24 = __Pyx_PyInt_AsInt(__pyx_t_21); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
            __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__compressReads); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_GOTREF(__pyx_t_21);
            __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_21); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
            __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 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_24, __pyx_t_12);
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          goto __pyx_L40;
        }
        __pyx_L40:;
      }
      __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_L23_try_end;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 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 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_12) {
        __Pyx_AddTraceback("variantcaller.callVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_21, &__pyx_t_22) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GOTREF(__pyx_t_21);
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_XDECREF(__pyx_v_e);
        __pyx_v_e = __pyx_t_21;

        /* "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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__exception); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        }
        __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        }
        __pyx_t_14 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        __pyx_t_1 = 0;
        __pyx_t_14 = 0;
        __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_14));
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_14));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
        __pyx_t_14 = 0;
        __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        }
        __pyx_t_14 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_chrom));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_14 = 0;
        __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L17_exception_handled;
      }
      __pyx_L18_except_error:;
      __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_L22_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_L14_continue;
      __pyx_L17_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_L23_try_end:;
    }
    __pyx_L14_continue:;
  }
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_WriteUnraisable("variantcaller.callVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __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;
  int __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;
  PY_LONG_LONG __pyx_t_5;
  PY_LONG_LONG __pyx_t_6;
  int __pyx_t_7;
  char *__pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  int __pyx_t_22;
  PyObject *(*__pyx_t_23)(PyObject *);
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_t_26;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_32), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_Multiply(__pyx_int_10, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsLongLong(__pyx_t_4); if (unlikely((__pyx_t_5 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_int_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_2); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->setCacheSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_t_5, __pyx_t_6);

  /* "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(((PyObject *)__pyx_v_refFile->refs) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_refFile->refs), ((PyObject *)__pyx_v_chrom)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__SeqLength); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_3); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_contigLength = __pyx_t_6;

  /* "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(((PyObject *)__pyx_v_refFile->refs) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_refFile->refs), ((PyObject *)__pyx_v_chrom)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__SeqLength); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Multiply(__pyx_int_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_7) {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsLongLong(__pyx_t_1); if (unlikely((__pyx_t_6 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, __pyx_v_chrom, __pyx_v_start, __pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_refSequenceBytes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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
 */
  __pyx_t_8 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_refSequenceBytes)); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_refSequence = __pyx_t_8;

  /* "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_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":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 list, got %.200s", Py_TYPE(__pyx_v_bamFiles)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_t_1 = ((PyObject *)__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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_readBuffers = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 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_12 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_e = __pyx_t_3;

      /* "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_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__error); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_2 = 0;
      __pyx_t_14 = 0;
      __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_14));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
      __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_13 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_14 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_13));
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_13));
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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_4); __pyx_t_4 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_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_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    __pyx_L10_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_7 = (__pyx_v_readBuffers == ((PyObject*)Py_None));
  __pyx_t_16 = (__pyx_t_7 != 0);
  if (__pyx_t_16) {

    /* "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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_28), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "variantcaller.pyx":650
 * 
 * 
 *     if options.sourceFile != None:             # <<<<<<<<<<<<<<
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__sourceFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (__pyx_t_16) {

    /* "variantcaller.pyx":651
 * 
 *     if options.sourceFile != None:
 *         variantSource = variantutils.VariantCandidateReader(options.sourceFile, options).Variants(chrom, start, end)             # <<<<<<<<<<<<<<
 * 
 *     tempSource = options.sourceFile
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__variantutils); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__sourceFile); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    __pyx_t_13 = 0;
    __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__Variants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_chrom));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_13 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_variantSource));
    __pyx_v_variantSource = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__sourceFile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_tempSource = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __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_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblerKmerSize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__assemblerKmerSize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = ((PyObject *)__pyx_f_13variantcaller_generateVariantsInRegion(__pyx_v_chrom, __pyx_t_12, __pyx_t_17, __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_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allAssemblyVariants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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, ((PyObject *)__pyx_v_tempSource)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __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_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_filteredAssemblyVariants = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":659
 *     cdef list filteredAssemblyVariants = []
 * 
 *     for thisVar in allAssemblyVariants:             # <<<<<<<<<<<<<<
 *         if thisVar.refPos + len(thisVar.removed) < start:
 *             continue
 */
  if (unlikely(((PyObject *)__pyx_v_allAssemblyVariants) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_allAssemblyVariants); __Pyx_INCREF(__pyx_t_1); __pyx_t_18 = 0;
  for (;;) {
    if (__pyx_t_18 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_18); __Pyx_INCREF(__pyx_t_4); __pyx_t_18++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7variant_Variant))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_thisVar));
    __pyx_v_thisVar = ((struct __pyx_obj_7variant_Variant *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "variantcaller.pyx":660
 * 
 *     for thisVar in allAssemblyVariants:
 *         if thisVar.refPos + len(thisVar.removed) < start:             # <<<<<<<<<<<<<<
 *             continue
 *         if thisVar.refPos > end :
 */
    __pyx_t_4 = ((PyObject *)__pyx_v_thisVar->removed);
    __Pyx_INCREF(__pyx_t_4);
    if (unlikely(__pyx_t_4 == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_19 = PyBytes_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_16 = (((__pyx_v_thisVar->refPos + __pyx_t_19) < __pyx_v_start) != 0);
    if (__pyx_t_16) {

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

    /* "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_16 = ((__pyx_v_thisVar->refPos > __pyx_v_end) != 0);
    if (__pyx_t_16) {

      /* "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_L15_continue;
      goto __pyx_L18;
    }
    __pyx_L18:;

    /* "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_16 = ((__pyx_v_thisVar->varType == 3) != 0);
    if (__pyx_t_16) {
      __pyx_t_4 = ((PyObject *)__pyx_v_thisVar->removed);
      __Pyx_INCREF(__pyx_t_4);
      if (unlikely(__pyx_t_4 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_19 = PyBytes_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = ((__pyx_t_19 > (__pyx_v_end - __pyx_v_thisVar->refPos)) != 0);
      if (__pyx_t_7) {
        __pyx_t_4 = ((PyObject *)__pyx_v_thisVar->removed);
        __Pyx_INCREF(__pyx_t_4);
        if (unlikely(__pyx_t_4 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_19 = PyBytes_GET_SIZE(__pyx_t_4); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_20 = ((__pyx_t_19 > 200) != 0);
        __pyx_t_21 = __pyx_t_20;
      } else {
        __pyx_t_21 = __pyx_t_7;
      }
      __pyx_t_7 = __pyx_t_21;
    } else {
      __pyx_t_7 = __pyx_t_16;
    }
    if (__pyx_t_7) {

      /* "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_L15_continue;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "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_4 = ((PyObject *)__pyx_f_13variantFilter_trimLongVar(__pyx_v_thisVar, __pyx_v_start, __pyx_v_end)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF(((PyObject *)__pyx_v_var));
    __pyx_v_var = ((struct __pyx_obj_7variant_Variant *)__pyx_t_4);
    __pyx_t_4 = 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_22 = __Pyx_PyList_Append(__pyx_v_filteredAssemblyVariants, ((PyObject *)__pyx_v_var)); if (unlikely(__pyx_t_22 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L15_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "variantcaller.pyx":669
 *         filteredAssemblyVariants.append(var)
 * 
 *     cdef list longVarList=[]             # <<<<<<<<<<<<<<
 *     cdef list windowHapList=[]
 *     cdef list windowLongVars=[]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_longVarList = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":670
 * 
 *     cdef list longVarList=[]
 *     cdef list windowHapList=[]             # <<<<<<<<<<<<<<
 *     cdef list windowLongVars=[]
 *     cdef int nWindow =0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_windowHapList = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":671
 *     cdef list longVarList=[]
 *     cdef list windowHapList=[]
 *     cdef list windowLongVars=[]             # <<<<<<<<<<<<<<
 *     cdef int nWindow =0
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_windowLongVars = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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_1 = __pyx_int_0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_windowGenerator, __pyx_n_s__WindowsAndVariants); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_13 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_2 = PyLong_FromLongLong(__pyx_v_maxContigPos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_15 = PyTuple_New(6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_filteredAssemblyVariants));
  PyTuple_SET_ITEM(__pyx_t_15, 4, ((PyObject *)__pyx_v_filteredAssemblyVariants));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_filteredAssemblyVariants));
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_3 = 0;
  __pyx_t_13 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_15 = __pyx_t_2; __Pyx_INCREF(__pyx_t_15); __pyx_t_18 = 0;
    __pyx_t_23 = NULL;
  } else {
    __pyx_t_18 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_23 = Py_TYPE(__pyx_t_15)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_23 && PyList_CheckExact(__pyx_t_15)) {
      if (__pyx_t_18 >= PyList_GET_SIZE(__pyx_t_15)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_18); __Pyx_INCREF(__pyx_t_2); __pyx_t_18++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_15, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_23 && PyTuple_CheckExact(__pyx_t_15)) {
      if (__pyx_t_18 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_18); __Pyx_INCREF(__pyx_t_2); __pyx_t_18++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_15, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_23(__pyx_t_15);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_window));
    __pyx_v_window = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_windowIndex);
    __pyx_v_windowIndex = __pyx_t_1;
    __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 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_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":677
 *         nWindow +=1
 *         try:
 *             chrom = window['chromosome']             # <<<<<<<<<<<<<<
 *             windowStart = window['startPos']
 *             windowEnd = window['endPos']
 */
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__chromosome)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_DECREF(((PyObject *)__pyx_v_chrom));
        __pyx_v_chrom = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "variantcaller.pyx":678
 *         try:
 *             chrom = window['chromosome']
 *             windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *             windowEnd = window['endPos']
 * 
 */
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF(__pyx_v_windowStart);
        __pyx_v_windowStart = __pyx_t_2;
        __pyx_t_2 = 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(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_XDECREF(__pyx_v_windowEnd);
        __pyx_v_windowEnd = __pyx_t_2;
        __pyx_t_2 = 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_2 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_13 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (__pyx_t_7) {
          if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          }
          __pyx_t_13 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_19 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_16 = (__pyx_t_19 > 0);
          __pyx_t_21 = __pyx_t_16;
        } else {
          __pyx_t_21 = __pyx_t_7;
        }
        if (__pyx_t_21) {

          /* "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_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = PyNumber_Subtract(__pyx_v_windowEnd, __pyx_v_windowStart); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__maxSize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chrom));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
          __Pyx_INCREF(__pyx_v_windowStart);
          PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_windowStart);
          __Pyx_GIVEREF(__pyx_v_windowStart);
          __Pyx_INCREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_windowEnd);
          __Pyx_GIVEREF(__pyx_v_windowEnd);
          PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_13 = 0;
          __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_29), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
          __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "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_L28_try_continue;
          goto __pyx_L30;
        }
        __pyx_L30:;

        /* "variantcaller.pyx":685
 *                 continue
 * 
 *             if len(window['variants']) > 0:             # <<<<<<<<<<<<<<
 *                 windowLongVars = callHLAVariantsInWindow(window, options, refFile, readBuffers, pop, start, end, refSequence)
 *                 longVarList.extend(windowLongVars)
 */
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        }
        __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_19 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_19 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_21 = ((__pyx_t_19 > 0) != 0);
        if (__pyx_t_21) {

          /* "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_2 = ((PyObject *)__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_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(((PyObject *)__pyx_v_windowLongVars));
          __pyx_v_windowLongVars = ((PyObject*)__pyx_t_2);
          __pyx_t_2 = 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_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_longVarList), __pyx_n_s__extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(((PyObject *)__pyx_v_windowLongVars));
          PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_windowLongVars));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_windowLongVars));
          __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          goto __pyx_L31;
        }
        __pyx_L31:;
      }
      __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_L29_try_end;
      __pyx_L22_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 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_17 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_17) {
        __Pyx_AddTraceback("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_e);
        __pyx_v_e = __pyx_t_3;

        /* "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_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__exception); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_t_13 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_t_24 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_25);
        PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_24);
        __Pyx_GIVEREF(__pyx_t_24);
        __Pyx_INCREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        __pyx_t_13 = 0;
        __pyx_t_24 = 0;
        __pyx_t_24 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_30), ((PyObject *)__pyx_t_25)); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_24));
        __Pyx_DECREF(((PyObject *)__pyx_t_25)); __pyx_t_25 = 0;
        __pyx_t_25 = PyTuple_New(1); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_25);
        PyTuple_SET_ITEM(__pyx_t_25, 0, ((PyObject *)__pyx_t_24));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_24));
        __pyx_t_24 = 0;
        __pyx_t_24 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_25), NULL); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_25)); __pyx_t_25 = 0;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 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_t_24 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_24, __pyx_n_s__warning); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_t_24 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_24);
        if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_t_14 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
        PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_chrom));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
        PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_24);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        __pyx_t_24 = 0;
        __pyx_t_14 = 0;
        __pyx_t_14 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_31), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_14));
        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
        __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_14));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_14));
        __pyx_t_14 = 0;
        __pyx_t_14 = PyObject_Call(__pyx_t_25, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L23_exception_handled;
      }
      __pyx_L24_except_error:;
      __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_L28_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_L20_continue;
      __pyx_L23_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_L29_try_end:;
    }
    __pyx_L20_continue:;
  }
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allVarSourceHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":693
 * 
 *     cdef list allVarSourceHaplotypes = []
 *     cdef list allAssemblerHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allHaplotypes = []
 *     cdef list allUniqueHaplotypes = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allAssemblerHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "variantcaller.pyx":694
 *     cdef list allVarSourceHaplotypes = []
 *     cdef list allAssemblerHaplotypes = []
 *     cdef list allHaplotypes = []             # <<<<<<<<<<<<<<
 *     cdef list allUniqueHaplotypes = []
 *     cdef list allGenotypes = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allGenotypes = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 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_1 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__rlen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chrom));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  __Pyx_INCREF(((PyObject *)__pyx_empty_tuple));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_empty_tuple));
  __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple));
  __Pyx_INCREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_v_refFile));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refFile));
  PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_1 = 0;
  __pyx_t_15 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10chaplotype_Haplotype)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_v_refHaplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_2);
  __pyx_t_2 = 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 = 100;

  /* "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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = ((PyObject *)__pyx_v_readBuffers); __Pyx_INCREF(__pyx_t_2); __pyx_t_18 = 0;
  for (;;) {
    if (__pyx_t_18 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_18); __Pyx_INCREF(__pyx_t_3); __pyx_t_18++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_readBuffer));
    __pyx_v_readBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_3);
    __pyx_t_3 = 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__qualBinSize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_17);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = PyObject_RichCompare(((PyObject *)__pyx_v_variantSource), Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_21) {

    /* "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_2 = ((PyObject *)__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_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_v_allVarSourceHaplotypes));
    __pyx_v_allVarSourceHaplotypes = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L36;
  }
  __pyx_L36:;

  /* "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_21 = ((__pyx_v_nWindow == 0) != 0);
  if (__pyx_t_21) {

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

      /* "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_2 = ((PyObject *)((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_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_ref = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 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),'.', ref, ".", "100", "REFCALL", infoLine, format])
 */
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
      __pyx_v_format = ((PyObject *)__pyx_kp_s_33);

      /* "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),'.', ref, ".", "100", "REFCALL", infoLine, format])
 *             for i from 0 <= i < options.nInd:
 */
      __pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_kp_s_34), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_kp_s_35)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromLong(__pyx_v_end); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __pyx_t_15 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_t_15, ((PyObject *)__pyx_kp_s_36)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyInt_FromLong(((__pyx_v_end - __pyx_v_start) + 1)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_v_infoLine = __pyx_t_2;
      __pyx_t_2 = 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),'.', ref, ".", "100", "REFCALL", infoLine, format])             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < options.nInd:
 *                 readBuffer = readBuffers[i]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_37), __pyx_n_s__join); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_15 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(((PyObject *)__pyx_v_chrom));
      PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_chrom));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_chrom));
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __Pyx_INCREF(((PyObject *)__pyx_v_ref));
      PyList_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_ref));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_ref));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s__100));
      PyList_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_kp_s__100));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__100));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__REFCALL));
      PyList_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_n_s__REFCALL));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REFCALL));
      __Pyx_INCREF(__pyx_v_infoLine);
      PyList_SET_ITEM(__pyx_t_3, 7, __pyx_v_infoLine);
      __Pyx_GIVEREF(__pyx_v_infoLine);
      __Pyx_INCREF(__pyx_v_format);
      PyList_SET_ITEM(__pyx_t_3, 8, __pyx_v_format);
      __Pyx_GIVEREF(__pyx_v_format);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_3));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __pyx_v_theLine = __pyx_t_3;
      __pyx_t_3 = 0;

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

        /* "variantcaller.pyx":717
 *             theLine = "\t".join([chrom, str(start),'.', 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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_readBuffers), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t, 1, 1, 0); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_XDECREF(((PyObject *)__pyx_v_readBuffer));
        __pyx_v_readBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_3);
        __pyx_t_3 = 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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_39), __pyx_n_s__join); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_15 = PyInt_FromLong(__pyx_v_nReads); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_15);
        __pyx_t_15 = 0;
        __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __pyx_t_2 = PyInt_FromLong(__pyx_v_nReads); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __pyx_t_1 = PyInt_FromLong(__pyx_v_nReads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
        PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_40));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_41));
        PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_41));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_41));
        PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_15);
        PyList_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyList_SET_ITEM(__pyx_t_4, 4, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_15 = 0;
        __pyx_t_2 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_v_sampleLine);
        __pyx_v_sampleLine = __pyx_t_4;
        __pyx_t_4 = 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_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_37), __pyx_v_sampleLine); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_theLine, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_v_theLine);
        __pyx_v_theLine = __pyx_t_1;
        __pyx_t_1 = 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_outputFile, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), __pyx_v_theLine); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

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

    /* "variantcaller.pyx":726
 *             allHaplotypes = allVarSourceHaplotypes
 *     else:
 *         allAssemblerHaplotypes = variantFilter.getAllAssemblerHaplotypesInRegion(chrom, start, end, refFile, options, sorted(longVarList), refHaplotype, readBuffers)             # <<<<<<<<<<<<<<
 *         allHaplotypes =  allAssemblerHaplotypes +  allVarSourceHaplotypes
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_longVarList));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_longVarList));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_longVarList));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = ((PyObject *)__pyx_f_13variantFilter_getAllAssemblerHaplotypesInRegion(__pyx_v_chrom, __pyx_v_start, __pyx_v_end, __pyx_v_refFile, __pyx_v_options, ((PyObject*)__pyx_t_3), __pyx_v_refHaplotype, __pyx_v_readBuffers)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_allAssemblerHaplotypes));
    __pyx_v_allAssemblerHaplotypes = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 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_4 = PyNumber_Add(((PyObject *)__pyx_v_allAssemblerHaplotypes), ((PyObject *)__pyx_v_allVarSourceHaplotypes)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__pyx_v_allHaplotypes));
    __pyx_v_allHaplotypes = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L37:;

  /* "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_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_refHaplotype));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_refHaplotype));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_refHaplotype));
  __pyx_t_3 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_v_allHaplotypes)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_f_13variantcaller_mergeHaplotypes(((PyObject*)__pyx_t_3), __pyx_v_refFile)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_allUniqueHaplotypes));
  __pyx_v_allUniqueHaplotypes = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 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_18 = 0;
  __pyx_t_4 = ((PyObject *)__pyx_v_allUniqueHaplotypes); __Pyx_INCREF(__pyx_t_4); __pyx_t_19 = 0;
  for (;;) {
    if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_19); __Pyx_INCREF(__pyx_t_3); __pyx_t_19++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10chaplotype_Haplotype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_hap));
    __pyx_v_hap = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_i = __pyx_t_18;
    __pyx_t_18 = (__pyx_t_18 + 1);

    /* "variantcaller.pyx":731
 *     allUniqueHaplotypes = mergeHaplotypes([refHaplotype] + allHaplotypes , refFile)
 *     for i, hap in enumerate(allUniqueHaplotypes):
 *         logger.debug('Haplotype %d: %s' %(i, str(hap)))             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_hap));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_hap));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_hap));
    __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_15);
    __pyx_t_3 = 0;
    __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_43), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_15));
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_15));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_15));
    __pyx_t_15 = 0;
    __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":734
 * 
 * 
 *     readBuffer = readBuffers[0]             # <<<<<<<<<<<<<<
 *     tempReads = readBuffer.reads.windowStart
 *     if readBuffer.reads.windowEnd - readBuffer.reads.windowStart > 0:
 */
  if (unlikely(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyList_GET_ITEM(__pyx_v_readBuffers, 0);
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_XDECREF(((PyObject *)__pyx_v_readBuffer));
  __pyx_v_readBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_4);
  __pyx_t_4 = 0;

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

  /* "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_21 = (((__pyx_v_readBuffer->reads->windowEnd - __pyx_v_readBuffer->reads->windowStart) > 0) != 0);
  if (__pyx_t_21) {

    /* "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]);
    goto __pyx_L43;
  }
  __pyx_L43:;

  /* "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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__nInd); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_f_8vcfutils_outputHLACallToVCF(__pyx_v_allUniqueHaplotypes, __pyx_v_readBuffers, __pyx_t_17, __pyx_v_refFile, __pyx_v_outputFile, __pyx_v_options, __pyx_v_start, __pyx_v_end);

  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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_WriteUnraisable("variantcaller.callHLAVariantsInRegion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_readBuffers)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_readBuffers), __pyx_v_i, sizeof(long), PyInt_FromLong, 1, 1, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theBuffer));
    __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;

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

/* 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 = {__Pyx_NAMESTR("outputRefCall"), (PyCFunction)__pyx_pw_13variantcaller_3outputRefCall, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__chrom)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pop)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__vcfFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__refFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__outputFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__windowIndex)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__readBuffers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputRefCall", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outputRefCall") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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_AsInt(values[5]); if (unlikely((__pyx_v_windowIndex == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pop), __pyx_ptype_11cpopulation_Population, 1, "pop", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_refFile), __pyx_ptype_9fastafile_FastaFile, 1, "refFile", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), (&PyDict_Type), 1, "window", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_readBuffers), (&PyList_Type), 1, "readBuffers", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __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):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outputRefCall", 0);

  /* "variantcaller.pyx":767
 *     """
 *     """
 *     cdef int windowStart = window['startPos']             # <<<<<<<<<<<<<<
 *     cdef int windowEnd = window['endPos']
 *     cdef int windowSize = windowEnd - windowStart
 */
  if (unlikely(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__startPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__endPos)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_window) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_window), ((PyObject *)__pyx_n_s__variants)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __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 list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_readBuffers)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __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 = ((PyObject *)__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_COMPILING_IN_CPYTHON
    __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_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theBuffer));
    __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 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_granularity); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    if (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_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    for (;;) {
      if (!__pyx_t_10 && PyList_CheckExact(__pyx_t_8)) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_10 && PyTuple_CheckExact(__pyx_t_8)) {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_7 = __pyx_t_10(__pyx_t_8);
        if (unlikely(!__pyx_t_7)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __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 == -1) != 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));
        goto __pyx_L7;
      }
      /*else*/ {

        /* "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?
 */
        __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:;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __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;
    goto __pyx_L8;
  }
  /*else*/ {

    /* "variantcaller.pyx":800
 *         qual = 0
 *     else:
 *         if len(variants) == 0:             # <<<<<<<<<<<<<<
 *             qual = phredPValue
 *         else:
 */
    if (unlikely(((PyObject *)__pyx_v_variants) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_3 = PyList_GET_SIZE(((PyObject *)__pyx_v_variants)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(__pyx_v_phredPValue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_qual = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L9;
    }
    /*else*/ {

      /* "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
 */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(((PyObject *)__pyx_v_variants) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = ((PyObject *)__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_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
        __Pyx_XDECREF(__pyx_v_v);
        __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_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_1));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_builtin_max, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_v_maxPost = __pyx_t_1;
      __pyx_t_1 = 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_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyFloat_FromDouble(-0.1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyNumber_Multiply(__pyx_t_8, __pyx_v_maxPost); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Power(__pyx_int_10, __pyx_t_7, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyNumber_Subtract(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_maxProbVar = __pyx_t_7;
      __pyx_t_7 = 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_7 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyNumber_Subtract(__pyx_t_7, __pyx_v_maxProbVar); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __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 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyNumber_Subtract(__pyx_t_8, __pyx_v_probRef); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyFloat_FromDouble(round((-10.0 * log10(__pyx_t_14)))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_1 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_11) {
        __pyx_t_6 = PyInt_FromLong(__pyx_t_13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_8 = __pyx_t_7;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_qual = __pyx_t_7;
      __pyx_t_7 = 0;
    }
    __pyx_L9:;
  }
  __pyx_L8:;

  /* "variantcaller.pyx":810
 * 
 *     # Sort out VCF output
 *     ref = refFile.getSequence(chrom, windowStart, windowStart+1)             # <<<<<<<<<<<<<<
 *     alt = None
 * 
 */
  __pyx_t_7 = ((PyObject *)((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_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_ref = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 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 = 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(((PyObject *)__pyx_v_ref), ((PyObject *)__pyx_n_s__N), Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __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_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__T));
    PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__T));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T));
    __Pyx_DECREF(__pyx_v_alt);
    __pyx_v_alt = ((PyObject *)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "variantcaller.pyx":818
 *         alt = ["T"]
 *     else:
 *         alt = ["N"]             # <<<<<<<<<<<<<<
 * 
 *     id = "."
 */
    __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
    PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__N));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
    __Pyx_DECREF(__pyx_v_alt);
    __pyx_v_alt = ((PyObject *)__pyx_t_7);
    __pyx_t_7 = 0;
  }
  __pyx_L12:;

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

  /* "variantcaller.pyx":821
 * 
 *     id = "."
 *     linefilter = ["REFCALL"]             # <<<<<<<<<<<<<<
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__REFCALL));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__REFCALL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REFCALL));
  __pyx_v_linefilter = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "variantcaller.pyx":822
 *     id = "."
 *     linefilter = ["REFCALL"]
 *     lineinfo = {}             # <<<<<<<<<<<<<<
 *     lineinfo['END'] = [windowEnd]
 *     lineinfo['Size'] = [windowSize]
 */
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  __pyx_v_lineinfo = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "variantcaller.pyx":823
 *     linefilter = ["REFCALL"]
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]             # <<<<<<<<<<<<<<
 *     lineinfo['Size'] = [windowSize]
 * 
 */
  __pyx_t_7 = PyInt_FromLong(__pyx_v_windowEnd); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__END), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

  /* "variantcaller.pyx":824
 *     lineinfo = {}
 *     lineinfo['END'] = [windowEnd]
 *     lineinfo['Size'] = [windowSize]             # <<<<<<<<<<<<<<
 * 
 *     # I'll fill in some of these later.
 */
  __pyx_t_8 = PyInt_FromLong(__pyx_v_windowSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__Size), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":827
 * 
 *     # I'll fill in some of these later.
 *     lineinfo['FR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__FR), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":828
 *     # I'll fill in some of these later.
 *     lineinfo['FR'] = ["."]
 *     lineinfo['MMLQ'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__MMLQ), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":829
 *     lineinfo['FR'] = ["."]
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__HP), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":830
 *     lineinfo['MMLQ'] = ["."]
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__TCR), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":831
 *     lineinfo['HP'] = ["."]
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__WE), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":832
 *     lineinfo['TCR'] = ["."]
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__WS), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":833
 *     lineinfo['WE'] = ["."]
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__Source), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":834
 *     lineinfo['WS'] = ["."]
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__FS), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":835
 *     lineinfo['Source'] = ["."]
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__START), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":836
 *     lineinfo['FS'] = ["."]
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__PP), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":837
 *     lineinfo['START'] = ["."]
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__TR), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":838
 *     lineinfo['PP'] = ["."]
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__NF), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":839
 *     lineinfo['TR'] = ["."]
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__TCF), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":840
 *     lineinfo['NF'] = ["."]
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__NR), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":841
 *     lineinfo['TCF'] = ["."]
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__TC), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":842
 *     lineinfo['NR'] = ["."]
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__MGOF), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":843
 *     lineinfo['TC'] = ["."]
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__SbPval), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":844
 *     lineinfo['MGOF'] = ["."]
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__ReadPosRankSum), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":845
 *     lineinfo['SbPval'] = ["."]
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__MQ), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":846
 *     lineinfo['ReadPosRankSum'] = ["."]
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__QD), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":847
 *     lineinfo['MQ'] = ["."]
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['BRF'] = ["."]
 *     lineinfo['HapScore'] = ["."]
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__SC), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":848
 *     lineinfo['QD'] = ["."]
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]             # <<<<<<<<<<<<<<
 *     lineinfo['HapScore'] = ["."]
 * 
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__BRF), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "variantcaller.pyx":849
 *     lineinfo['SC'] = ["."]
 *     lineinfo['BRF'] = ["."]
 *     lineinfo['HapScore'] = ["."]             # <<<<<<<<<<<<<<
 * 
 *     # Most of these are empty
 */
  __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  if (PyDict_SetItem(((PyObject *)__pyx_v_lineinfo), ((PyObject *)__pyx_n_s__HapScore), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_44));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
  __pyx_v_theFormat = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 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_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__chrom), ((PyObject *)__pyx_v_chrom)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyInt_FromLong(__pyx_v_windowStart); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__pos), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__ref), ((PyObject *)__pyx_v_ref)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__alt), __pyx_v_alt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__id), __pyx_v_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__info), ((PyObject *)__pyx_v_lineinfo)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__filter), ((PyObject *)__pyx_v_linefilter)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__qual), __pyx_v_qual) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_v_theFormat)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_vcfDataLine = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 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(((PyObject *)__pyx_v_readBuffers) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_readBuffers), __pyx_v_i, sizeof(long), PyInt_FromLong, 1, 1, 0); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cwindow_bamReadBuffer))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_theBuffer));
    __pyx_v_theBuffer = ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "variantcaller.pyx":859
 * 
 *         theBuffer = readBuffers[i]
 *         thisSample = theBuffer.sample             # <<<<<<<<<<<<<<
 * 
 *         # Missing genotype call. Probably due to zero coverage for this individual.
 */
    __pyx_t_7 = ((PyObject *)__pyx_v_theBuffer->sample);
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_XDECREF(((PyObject *)__pyx_v_thisSample));
    __pyx_v_thisSample = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 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_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __pyx_t_8 = PyList_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
      PyList_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_kp_s_45));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GT), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 2, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GL), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GQ), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GOF), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__NR), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__NV), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyDict_SetItem(((PyObject *)__pyx_v_vcfDataLine), ((PyObject *)__pyx_v_thisSample), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "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)
 */
      __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
      PyList_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_kp_s_45));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
      PyList_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_kp_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_6));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
      __pyx_t_6 = 0;
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GT), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyList_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_8, 1, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_8, 2, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GL), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GQ), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__GOF), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyInt_FromLong((__pyx_v_theBuffer->reads->windowEnd - __pyx_v_theBuffer->reads->windowStart)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__NR), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__NV), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyDict_SetItem(((PyObject *)__pyx_v_vcfDataLine), ((PyObject *)__pyx_v_thisSample), ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_vcfFile, __pyx_n_s__write_data); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_outputFile);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_outputFile);
  __Pyx_GIVEREF(__pyx_v_outputFile);
  __Pyx_INCREF(((PyObject *)__pyx_v_vcfDataLine));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_vcfDataLine));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vcfDataLine));
  __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_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
 */

static PyObject *__pyx_pf_13variantcaller_21PlatypusSingleProcess_4__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_continuing);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_continuing);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_continuing);
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("variantcaller.PlatypusSingleProcess.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_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__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_13variantcaller_21PlatypusSingleProcess_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__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};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[4] = __pyx_dynamic_args->__pyx_arg_continuing;
    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);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fileName)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__continuing);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bamFileNames);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samplesByID);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samplesByBAM);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bamFiles);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __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);
  __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 *);
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __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_1 = (__pyx_v_bamFiles != Py_None);
  if ((__pyx_t_1 != 0)) {
    __pyx_t_2 = (__pyx_v_theLocks != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
  } else {
    __pyx_t_3 = (__pyx_t_1 != 0);
  }
  if (__pyx_t_3) {

    /* "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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_bamFiles);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_bamFiles);
    __Pyx_GIVEREF(__pyx_v_bamFiles);
    __Pyx_INCREF(__pyx_v_theLocks);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_theLocks);
    __Pyx_GIVEREF(__pyx_v_theLocks);
    __pyx_t_5 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __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;
        #if CYTHON_COMPILING_IN_CPYTHON
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        #if CYTHON_COMPILING_IN_CPYTHON
        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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __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_L6_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_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L7_unpacking_done:;
      }
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_13htslibWrapper_Samfile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_theBamFile));
      __pyx_v_theBamFile = ((struct __pyx_obj_13htslibWrapper_Samfile *)__pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_v_theLock);
      __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;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __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__regions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_9));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "variantcaller.pyx":899
 * 
 *         # Need to load data etc.
 *         self.bamFileNames = options.bamFiles             # <<<<<<<<<<<<<<
 * 
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__bamFiles); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__bamFileNames, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bamFileNames); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__lower); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__endswith); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = ((__pyx_t_6 == 1) != 0);
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_isBamOrCram); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = ((!__pyx_t_1) != 0);
    __pyx_t_1 = __pyx_t_2;
  } else {
    __pyx_t_1 = __pyx_t_3;
  }
  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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bamFileNames); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_51), __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__platypusutils); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_52); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __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_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__bamFileNames, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "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_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__platypusutils); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_53); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__regions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __pyx_t_9 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_10);
    #else
    Py_ssize_t i;
    PyObject** temps[4] = {&__pyx_t_8,&__pyx_t_5,&__pyx_t_9,&__pyx_t_10};
    for (i=0; i < 4; i++) {
      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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_5,&__pyx_t_9,&__pyx_t_10};
    __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_12)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_12); if (unlikely(!item)) goto __pyx_L10_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_12), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L11_unpacking_done;
    __pyx_L10_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L11_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__samples, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__samplesByBAM, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __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_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__endswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__endswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__endswith); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __pyx_t_2;
    } else {
      __pyx_t_13 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_13;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "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_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__error); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_60), __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_9));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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, ((PyObject *)__pyx_kp_s_61), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "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_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s__refFile); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyNumber_Add(__pyx_t_4, ((PyObject *)__pyx_kp_s_62)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_9fastafile_FastaFile)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__refFile, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "variantcaller.pyx":916
 * 
 *         # Set these to sensible values, based on population size
 *         if self.options.maxHaplotypes == -1:             # <<<<<<<<<<<<<<
 *             self.options.maxHaplotypes = 257
 * 
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_4, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes, __pyx_int_257) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_10, __pyx_n_s_63, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_14 = 257;
  __pyx_t_9 = PyInt_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_10 = __pyx_t_4;
  } else {
    __pyx_t_5 = PyInt_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_t_10;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__platypusutils); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  __pyx_t_14 = 33153;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_10 = __pyx_t_5;
  } else {
    __pyx_t_9 = PyInt_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __pyx_t_9;
    __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_10;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_10, __pyx_n_s__maxGenotypes, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__HLATyping); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_3) {

    /* "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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__platypusutils); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_63); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_10, __pyx_n_s__maxGenotypes, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L14;
  }
  __pyx_L14:;

  /* "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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_63); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_65), __pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__debug); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxHaplotypes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_66), __pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__debug); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__maxGenotypes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_67), __pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "variantcaller.pyx":933
 *         logger.debug("Max genotypes = %s" %(self.options.maxGenotypes))
 * 
 *         options.nInd = len(set(self.samples))             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samples); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_6 = PySet_Size(__pyx_t_10); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_options, __pyx_n_s__nInd, __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  __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_12);
  __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;
}

/* 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 = {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_13variantcaller_21PlatypusSingleProcess_3run, METH_O, __Pyx_DOCSTR(__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));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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;
  int __pyx_t_5;
  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;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__vcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__VCF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __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__vcf, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__setheader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__vcfHeader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__platypusOptions));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__platypusOptions));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__platypusOptions));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__setsamples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samples); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "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_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__vcfutils); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__vcfInfoSignature); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__setfilter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__vcfutils); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__vcfFilterSignature); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "variantcaller.pyx":946
 *         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_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__setformat); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__vcfutils); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__vcfFormatSignature); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "variantcaller.pyx":947
 *         self.vcf.setfilter(vcfutils.vcfFilterSignature)
 *         self.vcf.setformat(vcfutils.vcfFormatSignature)
 *         self.windowGenerator = window.WindowGenerator()             # <<<<<<<<<<<<<<
 * 
 *         if self.continuing:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__window); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__windowGenerator, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__continuing); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {

    /* "variantcaller.pyx":950
 * 
 *         if self.continuing:
 *             logger.info("Opening file %s for appending" %(self.fileName))             # <<<<<<<<<<<<<<
 *             self.outputFile = Open(self.fileName, 'a')
 *         else:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__fileName); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_68), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__Open); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__fileName); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__a));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outputFile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "variantcaller.pyx":953
 *             self.outputFile = Open(self.fileName, 'a')
 *         else:
 *             if self.fileName == "-":             # <<<<<<<<<<<<<<
 *                 self.outputFile = sys.stdout
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__fileName); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_69), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "variantcaller.pyx":954
 *         else:
 *             if self.fileName == "-":
 *                 self.outputFile = sys.stdout             # <<<<<<<<<<<<<<
 *             else:
 *                 self.outputFile = Open(self.fileName, 'w')
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outputFile, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "variantcaller.pyx":956
 *                 self.outputFile = sys.stdout
 *             else:
 *                 self.outputFile = Open(self.fileName, 'w')             # <<<<<<<<<<<<<<
 *             self.vcf.writeheader(self.outputFile)
 * 
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__Open); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__fileName); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__w));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__outputFile, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__writeheader); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outputFile); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_11cpopulation_Population)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_70), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__w));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_fo = __pyx_t_4;
    __pyx_t_4 = 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_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s__close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "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_4 = __pyx_int_0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__regions); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __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 = 2; __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), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_chrom);
    __pyx_v_chrom = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_v_start);
    __pyx_v_start = __pyx_t_8;
    __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_v_end);
    __pyx_v_end = __pyx_t_9;
    __pyx_t_9 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF(__pyx_v_index);
    __pyx_v_index = __pyx_t_4;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4);
    __pyx_t_4 = __pyx_t_2;
    __pyx_t_2 = 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_2 = PyNumber_Remainder(__pyx_v_index, __pyx_int_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_5) {

      /* "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_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __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_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__bufferSize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      __Pyx_INCREF(__pyx_v_start);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_start);
      __Pyx_GIVEREF(__pyx_v_start);
      __Pyx_INCREF(__pyx_v_end);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_end);
      __Pyx_GIVEREF(__pyx_v_end);
      PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_73), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      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_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__verbosity); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_5) {

      /* "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_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__logger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_chrom);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_chrom);
      __Pyx_GIVEREF(__pyx_v_chrom);
      __Pyx_INCREF(__pyx_v_start);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_start);
      __Pyx_GIVEREF(__pyx_v_start);
      __Pyx_INCREF(__pyx_v_end);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_end);
      __Pyx_GIVEREF(__pyx_v_end);
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_74), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L10;
    }
    /*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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__HLATyping); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "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 bytes, got %.200s", Py_TYPE(__pyx_v_chrom)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_end); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bamFiles); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__refFile); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_9fastafile_FastaFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__windowGenerator); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outputFile); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samples); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      if (!(likely(PyList_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_15)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samplesByID); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_16);
      if (!(likely(PyDict_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_16)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samplesByBAM); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __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 dict, got %.200s", Py_TYPE(__pyx_t_17)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_f_13variantcaller_callHLAVariantsInRegion(((PyObject*)__pyx_v_chrom), __pyx_t_12, __pyx_t_13, __pyx_t_2, ((struct __pyx_obj_9fastafile_FastaFile *)__pyx_t_8), __pyx_t_9, __pyx_t_1, __pyx_t_10, __pyx_t_14, ((PyObject*)__pyx_t_15), ((PyObject*)__pyx_t_16), ((PyObject*)__pyx_t_17), __pyx_v_pop);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "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 != "-":
 */
      if (!(likely(PyBytes_CheckExact(__pyx_v_chrom))||((__pyx_v_chrom) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_chrom)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_start); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_v_end); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__bamFiles); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__refFile); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_16);
      if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_9fastafile_FastaFile))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__options); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__windowGenerator); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outputFile); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__vcf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samples); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      if (!(likely(PyList_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_9)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samplesByID); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_8)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__samplesByBAM); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_f_13variantcaller_callVariantsInRegion(((PyObject*)__pyx_v_chrom), __pyx_t_13, __pyx_t_12, __pyx_t_17, ((struct __pyx_obj_9fastafile_FastaFile *)__pyx_t_16), __pyx_t_15, __pyx_t_14, __pyx_t_10, __pyx_t_1, ((PyObject*)__pyx_t_9), ((PyObject*)__pyx_t_8), ((PyObject*)__pyx_t_2), __pyx_v_pop);
      __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_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L11:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__fileName); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_kp_s_69), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "variantcaller.pyx":980
 * 
 *         if self.fileName != "-":
 *             self.outputFile.close()             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__outputFile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L12;
  }
  __pyx_L12:;

  __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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __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
 */

static PyObject *__pyx_pf_13variantcaller_20PlatypusMultiProcess_4__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_continuing);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_continuing);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_continuing);
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __Pyx_INCREF(((PyObject *)Py_None));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)Py_None));
  __Pyx_GIVEREF(((PyObject *)Py_None));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("variantcaller.PlatypusMultiProcess.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_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__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_13variantcaller_20PlatypusMultiProcess_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__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};
    __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
    values[4] = __pyx_dynamic_args->__pyx_arg_continuing;
    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);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fileName)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__regions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__continuing);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samples);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bamFileNames);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samplesByID);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__samplesByBAM);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bamFiles);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__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_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __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);
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__multiprocessing); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__Process); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____init__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "variantcaller.pyx":994
 *         """
 *         multiprocessing.Process.__init__(self)
 *         self.singleProcess = PlatypusSingleProcess(fileName, options, regions, continuing, samples, bamFileNames, samplesByID, samplesByBAM, bamFiles, theLocks)             # <<<<<<<<<<<<<<
 * 
 *     def run(self):
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_75); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_fileName);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fileName);
  __Pyx_GIVEREF(__pyx_v_fileName);
  __Pyx_INCREF(__pyx_v_options);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_options);
  __Pyx_GIVEREF(__pyx_v_options);
  __Pyx_INCREF(__pyx_v_regions);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_regions);
  __Pyx_GIVEREF(__pyx_v_regions);
  __Pyx_INCREF(__pyx_v_continuing);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_continuing);
  __Pyx_GIVEREF(__pyx_v_continuing);
  __Pyx_INCREF(__pyx_v_samples);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_samples);
  __Pyx_GIVEREF(__pyx_v_samples);
  __Pyx_INCREF(__pyx_v_bamFileNames);
  PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_v_bamFileNames);
  __Pyx_GIVEREF(__pyx_v_bamFileNames);
  __Pyx_INCREF(__pyx_v_samplesByID);
  PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_v_samplesByID);
  __Pyx_GIVEREF(__pyx_v_samplesByID);
  __Pyx_INCREF(__pyx_v_samplesByBAM);
  PyTuple_SET_ITEM(__pyx_t_2, 7, __pyx_v_samplesByBAM);
  __Pyx_GIVEREF(__pyx_v_samplesByBAM);
  __Pyx_INCREF(__pyx_v_bamFiles);
  PyTuple_SET_ITEM(__pyx_t_2, 8, __pyx_v_bamFiles);
  __Pyx_GIVEREF(__pyx_v_bamFiles);
  __Pyx_INCREF(__pyx_v_theLocks);
  PyTuple_SET_ITEM(__pyx_t_2, 9, __pyx_v_theLocks);
  __Pyx_GIVEREF(__pyx_v_theLocks);
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s__singleProcess, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __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;
}

/* 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 = {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_13variantcaller_20PlatypusMultiProcess_3run, METH_O, __Pyx_DOCSTR(__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));
  __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
 */

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("run", 0);

  /* "variantcaller.pyx":1000
 *         Run a single Platypus process
 *         """
 *         self.singleProcess.run()             # <<<<<<<<<<<<<<
 * 
 * ##################################################################################################
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s__singleProcess); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__run); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("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;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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 & 1024) != 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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 & 512) != 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __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;

  __pyx_r = 0;
  __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 & 256) != 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __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 & 2048) != 0);
  goto __pyx_L0;

  __pyx_r = 0;
  __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));

  __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);

  __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 | 512);

}

/* "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 | 2048);

}

/* "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 & (~2048));

}

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("variantcaller"),
    __Pyx_DOCSTR(__pyx_k_76), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_n_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 1},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
  {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
  {&__pyx_kp_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 0},
  {&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
  {&__pyx_n_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 1},
  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
  {&__pyx_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1},
  {&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
  {&__pyx_n_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 1},
  {&__pyx_n_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 1},
  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
  {&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
  {&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
  {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 0},
  {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
  {&__pyx_kp_s_73, __pyx_k_73, sizeof(__pyx_k_73), 0, 0, 1, 0},
  {&__pyx_kp_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 0},
  {&__pyx_n_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 1},
  {&__pyx_kp_s_78, __pyx_k_78, sizeof(__pyx_k_78), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
  {&__pyx_n_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 1},
  {&__pyx_n_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 1},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0},
  {&__pyx_n_s_93, __pyx_k_93, sizeof(__pyx_k_93), 0, 0, 1, 1},
  {&__pyx_n_s_96, __pyx_k_96, sizeof(__pyx_k_96), 0, 0, 1, 1},
  {&__pyx_kp_s_97, __pyx_k_97, sizeof(__pyx_k_97), 0, 0, 1, 0},
  {&__pyx_n_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 1},
  {&__pyx_kp_s__100, __pyx_k__100, sizeof(__pyx_k__100), 0, 0, 1, 0},
  {&__pyx_n_s__BRF, __pyx_k__BRF, sizeof(__pyx_k__BRF), 0, 0, 1, 1},
  {&__pyx_n_s__END, __pyx_k__END, sizeof(__pyx_k__END), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__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_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_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_n_s__Log, __pyx_k__Log, sizeof(__pyx_k__Log), 0, 0, 1, 1},
  {&__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_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_n_s__Open, __pyx_k__Open, sizeof(__pyx_k__Open), 0, 0, 1, 1},
  {&__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__Process, __pyx_k__Process, sizeof(__pyx_k__Process), 0, 0, 1, 1},
  {&__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_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_n_s__SeqLength, __pyx_k__SeqLength, sizeof(__pyx_k__SeqLength), 0, 0, 1, 1},
  {&__pyx_n_s__Size, __pyx_k__Size, sizeof(__pyx_k__Size), 0, 0, 1, 1},
  {&__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_n_s__VCF, __pyx_k__VCF, sizeof(__pyx_k__VCF), 0, 0, 1, 1},
  {&__pyx_n_s__Variants, __pyx_k__Variants, sizeof(__pyx_k__Variants), 0, 0, 1, 1},
  {&__pyx_n_s__WE, __pyx_k__WE, sizeof(__pyx_k__WE), 0, 0, 1, 1},
  {&__pyx_n_s__WS, __pyx_k__WS, sizeof(__pyx_k__WS), 0, 0, 1, 1},
  {&__pyx_n_s__WindowGenerator, __pyx_k__WindowGenerator, sizeof(__pyx_k__WindowGenerator), 0, 0, 1, 1},
  {&__pyx_n_s__WindowsAndVariants, __pyx_k__WindowsAndVariants, sizeof(__pyx_k__WindowsAndVariants), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
  {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
  {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__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_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_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_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__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__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__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_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
  {&__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__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__getLogger, __pyx_k__getLogger, sizeof(__pyx_k__getLogger), 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_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__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__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__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__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__multiprocessing, __pyx_k__multiprocessing, sizeof(__pyx_k__multiprocessing), 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__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__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__probRef, __pyx_k__probRef, sizeof(__pyx_k__probRef), 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__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_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__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 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_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__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 int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s__max); if (!__pyx_builtin_max) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s__min); if (!__pyx_builtin_min) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StandardError = __Pyx_GetBuiltinName(__pyx_n_s__StandardError); if (!__pyx_builtin_StandardError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s__open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "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_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_18);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "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_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_20);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "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_k_tuple_22 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_21)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_22);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "variantcaller.pyx":901
 *         self.bamFileNames = options.bamFiles
 * 
 *         isBamOrCram = self.bamFileNames[0].lower().endswith((".bam", ".cram"))             # <<<<<<<<<<<<<<
 * 
 *         if len(self.bamFileNames) == 1 and not isBamOrCram:
 */
  __pyx_k_tuple_49 = PyTuple_Pack(2, ((PyObject *)__pyx_kp_s_47), ((PyObject *)__pyx_kp_s_48)); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_49);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
  __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_k_tuple_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_50);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));

  /* "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_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
  __pyx_k_tuple_57 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_56)); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_57);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
  __pyx_k_tuple_59 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_58)); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_59);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));

  /* "variantcaller.pyx":962
 *         if self.options.alignScoreFile != "":
 *             fo = open(self.options.alignScoreFile, 'w')
 *             fo.write("#Alignment score File\n")             # <<<<<<<<<<<<<<
 *             fo.close()
 * 
 */
  __pyx_k_tuple_72 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_71)); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_72);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));

  /* "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_k_tuple_77 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__Log)); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_77);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));

  /* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */
  __pyx_k_tuple_79 = PyTuple_Pack(13, ((PyObject *)__pyx_n_s__readBuffers), ((PyObject *)__pyx_n_s__theReadBuffer), ((PyObject *)__pyx_n_s__totalReads), ((PyObject *)__pyx_n_s__cigarSize), ((PyObject *)__pyx_n_s__seqQualSize), ((PyObject *)__pyx_n_s__readSize), ((PyObject *)__pyx_n_s__pointerSize), ((PyObject *)__pyx_n_s__totalBufferSize), ((PyObject *)__pyx_n_s__totalSeqQualSize), ((PyObject *)__pyx_n_s__thisBufferSize), ((PyObject *)__pyx_n_s__thisBadBufferSize), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__totalSize)); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_79);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));
  __pyx_k_codeobj_80 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s_12, 209, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "variantcaller.pyx":764
 * ###################################################################################################
 * 
 * def outputRefCall(bytes chrom, Population pop, vcfFile, FastaFile refFile, outputFile, int windowIndex, dict window, options, list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_k_tuple_82 = PyTuple_Pack(34, ((PyObject *)__pyx_n_s__chrom), ((PyObject *)__pyx_n_s__pop), ((PyObject *)__pyx_n_s__vcfFile), ((PyObject *)__pyx_n_s__refFile), ((PyObject *)__pyx_n_s__outputFile), ((PyObject *)__pyx_n_s__windowIndex), ((PyObject *)__pyx_n_s__window), ((PyObject *)__pyx_n_s__options), ((PyObject *)__pyx_n_s__readBuffers), ((PyObject *)__pyx_n_s__windowStart), ((PyObject *)__pyx_n_s__windowEnd), ((PyObject *)__pyx_n_s__windowSize), ((PyObject *)__pyx_n_s__variants), ((PyObject *)__pyx_n_s__nIndividuals), ((PyObject *)__pyx_n_s__theBuffer), ((PyObject *)__pyx_n_s__minCov), ((PyObject *)__pyx_n_s__theStart), ((PyObject *)__pyx_n_s__granularity), ((PyObject *)__pyx_n_s__index), ((PyObject *)__pyx_n_s__phredPValue), ((PyObject *)__pyx_n_s__qual), ((PyObject *)__pyx_n_s__maxPost), ((PyObject *)__pyx_n_s__maxProbVar), ((PyObject *)__pyx_n_s__probRef), ((PyObject *)__pyx_n_s__ref), ((PyObject *)__pyx_n_s__alt), ((PyObject *)__pyx_n_s__id), ((PyObject *)__pyx_n_s__linefilter), ((PyObject *)__pyx_n_s__lineinfo), ((PyObject *)__pyx_n_s__theFormat), ((PyObject *)__pyx_n_s__vcfDataLine), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__thisSample), ((PyObject *)__pyx_n_s__v)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_82);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));
  __pyx_k_codeobj_83 = (PyObject*)__Pyx_PyCode_New(9, 0, 34, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s__outputRefCall, 764, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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_k_tuple_84 = PyTuple_Pack(14, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__fileName), ((PyObject *)__pyx_n_s__options), ((PyObject *)__pyx_n_s__regions), ((PyObject *)__pyx_n_s__continuing), ((PyObject *)__pyx_n_s__samples), ((PyObject *)__pyx_n_s__bamFileNames), ((PyObject *)__pyx_n_s__samplesByID), ((PyObject *)__pyx_n_s__samplesByBAM), ((PyObject *)__pyx_n_s__bamFiles), ((PyObject *)__pyx_n_s__theLocks), ((PyObject *)__pyx_n_s__theBamFile), ((PyObject *)__pyx_n_s__theLock), ((PyObject *)__pyx_n_s__isBamOrCram)); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_84);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));
  __pyx_k_codeobj_85 = (PyObject*)__Pyx_PyCode_New(11, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s____init__, 880, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_k_tuple_87 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__pop), ((PyObject *)__pyx_n_s__fo), ((PyObject *)__pyx_n_s__index), ((PyObject *)__pyx_n_s__chrom), ((PyObject *)__pyx_n_s__start), ((PyObject *)__pyx_n_s__end)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_87);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
  __pyx_k_codeobj_88 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s__run, 935, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __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_k_tuple_91 = PyTuple_Pack(11, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__fileName), ((PyObject *)__pyx_n_s__options), ((PyObject *)__pyx_n_s__regions), ((PyObject *)__pyx_n_s__continuing), ((PyObject *)__pyx_n_s__samples), ((PyObject *)__pyx_n_s__bamFileNames), ((PyObject *)__pyx_n_s__samplesByID), ((PyObject *)__pyx_n_s__samplesByBAM), ((PyObject *)__pyx_n_s__bamFiles), ((PyObject *)__pyx_n_s__theLocks)); if (unlikely(!__pyx_k_tuple_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_91);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_91));
  __pyx_k_codeobj_92 = (PyObject*)__Pyx_PyCode_New(11, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s____init__, 989, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "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_k_tuple_94 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_94);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94));
  __pyx_k_codeobj_95 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_81, __pyx_n_s__run, 996, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_257 = PyInt_FromLong(257); if (unlikely(!__pyx_int_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initvariantcaller(void); /*proto*/
PyMODINIT_FUNC initvariantcaller(void)
#else
PyMODINIT_FUNC PyInit_variantcaller(void); /*proto*/
PyMODINIT_FUNC PyInit_variantcaller(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_variantcaller(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("variantcaller"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_76), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "variantcaller")) {
      if (unlikely(PyDict_SetItemString(modules, "variantcaller", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_variantcaller) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  /*--- Type import code ---*/
  __pyx_ptype_9fastafile_FastaIndex = __Pyx_ImportType("fastafile", "FastaIndex", sizeof(struct __pyx_obj_9fastafile_FastaIndex), 1); if (unlikely(!__pyx_ptype_9fastafile_FastaIndex)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9fastafile_FastaFile = __Pyx_ImportType("fastafile", "FastaFile", sizeof(struct __pyx_obj_9fastafile_FastaFile), 1); if (unlikely(!__pyx_ptype_9fastafile_FastaFile)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_13htslibWrapper_Samfile = __Pyx_ImportType("htslibWrapper", "Samfile", sizeof(struct __pyx_obj_13htslibWrapper_Samfile), 1); if (unlikely(!__pyx_ptype_13htslibWrapper_Samfile)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[5]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_13htslibWrapper_ReadIterator = __Pyx_ImportType("htslibWrapper", "ReadIterator", sizeof(struct __pyx_obj_13htslibWrapper_ReadIterator), 1); if (unlikely(!__pyx_ptype_13htslibWrapper_ReadIterator)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[5]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7variant_Variant = __Pyx_ImportType("variant", "Variant", sizeof(struct __pyx_obj_7variant_Variant), 1); if (unlikely(!__pyx_ptype_7variant_Variant)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[6]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7variant_VariantCandidateGenerator = __Pyx_ImportType("variant", "VariantCandidateGenerator", sizeof(struct __pyx_obj_7variant_VariantCandidateGenerator), 1); if (unlikely(!__pyx_ptype_7variant_VariantCandidateGenerator)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[6]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cwindow_ReadArray = __Pyx_ImportType("cwindow", "ReadArray", sizeof(struct __pyx_obj_7cwindow_ReadArray), 1); if (unlikely(!__pyx_ptype_7cwindow_ReadArray)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[7]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cwindow_bamReadBuffer = __Pyx_ImportType("cwindow", "bamReadBuffer", sizeof(struct __pyx_obj_7cwindow_bamReadBuffer), 1); if (unlikely(!__pyx_ptype_7cwindow_bamReadBuffer)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[7]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_11cpopulation_Population = __Pyx_ImportType("cpopulation", "Population", sizeof(struct __pyx_obj_11cpopulation_Population), 1); if (unlikely(!__pyx_ptype_11cpopulation_Population)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[8]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_10chaplotype_Haplotype = __Pyx_ImportType("chaplotype", "Haplotype", sizeof(struct __pyx_obj_10chaplotype_Haplotype), 1); if (unlikely(!__pyx_ptype_10chaplotype_Haplotype)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[9]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9cgenotype_DiploidGenotype = __Pyx_ImportType("cgenotype", "DiploidGenotype", sizeof(struct __pyx_obj_9cgenotype_DiploidGenotype), 1); if (unlikely(!__pyx_ptype_9cgenotype_DiploidGenotype)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[10]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_9cgenotype_HaploidGenotype = __Pyx_ImportType("cgenotype", "HaploidGenotype", sizeof(struct __pyx_obj_9cgenotype_HaploidGenotype), 1); if (unlikely(!__pyx_ptype_9cgenotype_HaploidGenotype)) {__pyx_filename = __pyx_f[10]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[10]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("variant"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "PLATYPUS_VAR", (void **)&__pyx_vp_7variant_PLATYPUS_VAR, "int") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "FILE_VAR", (void **)&__pyx_vp_7variant_FILE_VAR, "int") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "ASSEMBLER_VAR", (void **)&__pyx_vp_7variant_ASSEMBLER_VAR, "int") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Function import code ---*/
  __pyx_t_2 = __Pyx_ImportModule("platypusutils"); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_2, "betaBinomialCDF", (void (**)(void))&__pyx_f_13platypusutils_betaBinomialCDF, "double (int, int, int, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_2, "loadBAMData", (void (**)(void))&__pyx_f_13platypusutils_loadBAMData, "PyObject *(PyObject *, PyObject *, int, int, PyObject *, PyObject *, PyObject *, PyObject *, char *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_2, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_ImportModule("vcfutils"); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_3, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_3, "refAndAlt", (void (**)(void))&__pyx_f_8vcfutils_refAndAlt, "PyObject *(char *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_3, "outputHLACallToVCF", (void (**)(void))&__pyx_f_8vcfutils_outputHLACallToVCF, "void (PyObject *, PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, int, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_ImportModule("variantFilter"); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "filterVariants", (void (**)(void))&__pyx_f_13variantFilter_filterVariants, "PyObject *(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, int, int, int, int, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "padVariants", (void (**)(void))&__pyx_f_13variantFilter_padVariants, "PyObject *(PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "computeVariantReadSupportFrac", (void (**)(void))&__pyx_f_13variantFilter_computeVariantReadSupportFrac, "double (struct __pyx_obj_7variant_Variant *, struct __pyx_obj_7cwindow_bamReadBuffer *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "normaliseVar", (void (**)(void))&__pyx_f_13variantFilter_normaliseVar, "struct __pyx_obj_7variant_Variant *(struct __pyx_obj_7variant_Variant *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "trimLongVar", (void (**)(void))&__pyx_f_13variantFilter_trimLongVar, "struct __pyx_obj_7variant_Variant *(struct __pyx_obj_7variant_Variant *, int, int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_4, "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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_ImportModule("cgenotype"); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_5, "generateAllGenotypesFromHaplotypeList", (void (**)(void))&__pyx_f_9cgenotype_generateAllGenotypesFromHaplotypeList, "PyObject *(PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_ImportModule("assembler"); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_6, "assembleReadsAndDetectVariants", (void (**)(void))&__pyx_f_9assembler_assembleReadsAndDetectVariants, "PyObject *(char *, int, int, int, int, PyObject *, char *, PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  /*--- Execution code ---*/

  /* "variantcaller.pyx":7
 * from __future__ import division
 * 
 * import logging             # <<<<<<<<<<<<<<
 * import multiprocessing
 * import window
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logging, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":8
 * 
 * import logging
 * import multiprocessing             # <<<<<<<<<<<<<<
 * import window
 * import vcf
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__multiprocessing), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__multiprocessing, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":9
 * import logging
 * import multiprocessing
 * import window             # <<<<<<<<<<<<<<
 * import vcf
 * import variantutils
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__window), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__window, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":10
 * import multiprocessing
 * import window
 * import vcf             # <<<<<<<<<<<<<<
 * import variantutils
 * import time
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__vcf), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__vcf, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":11
 * import window
 * import vcf
 * import variantutils             # <<<<<<<<<<<<<<
 * import time
 * import datetime
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__variantutils), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__variantutils, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":12
 * import vcf
 * import variantutils
 * import time             # <<<<<<<<<<<<<<
 * import datetime
 * import platypusutils
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__time, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":13
 * import variantutils
 * import time
 * import datetime             # <<<<<<<<<<<<<<
 * import platypusutils
 * import vcfutils
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__datetime, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":14
 * import time
 * import datetime
 * import platypusutils             # <<<<<<<<<<<<<<
 * import vcfutils
 * import chaplotype
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__platypusutils), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__platypusutils, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":15
 * import datetime
 * import platypusutils
 * import vcfutils             # <<<<<<<<<<<<<<
 * import chaplotype
 * import sys
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__vcfutils), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__vcfutils, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":16
 * import platypusutils
 * import vcfutils
 * import chaplotype             # <<<<<<<<<<<<<<
 * import sys
 * 
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__chaplotype), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__chaplotype, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":17
 * import vcfutils
 * import chaplotype
 * import sys             # <<<<<<<<<<<<<<
 * 
 * cimport platypusutils
 */
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__sys, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bisect));
  PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__bisect));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bisect));
  __pyx_t_8 = __Pyx_Import(((PyObject *)__pyx_n_s__bisect), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_ImportFrom(__pyx_t_8, __pyx_n_s__bisect); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__bisect, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":48
 * from platypusutils cimport leftNormaliseIndel
 * from platypusutils cimport betaBinomialCDF
 * from platypusutils import Open             # <<<<<<<<<<<<<<
 * 
 * logger = logging.getLogger("Log")
 */
  __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Open));
  PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_n_s__Open));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Open));
  __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__platypusutils), ((PyObject *)__pyx_t_8), -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s__Open); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__Open, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__logging); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__getLogger); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__logger, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":51
 * 
 * logger = logging.getLogger("Log")
 * vcfHeader = [('fileDate',datetime.date.fromtimestamp(time.time())), ('source','Platypus_Version_%s' %(platypusutils.PLATYPUS_VERSION))]             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__datetime); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__date); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__fromtimestamp); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__time); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fileDate));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_n_s__fileDate));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fileDate));
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__platypusutils); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__PLATYPUS_VERSION); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_78), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__source));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__source));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_t_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
  __pyx_t_8 = 0;
  __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  PyList_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_t_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
  __pyx_t_9 = 0;
  __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__vcfHeader, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

  /* "variantcaller.pyx":209
 * 
 * ###################################################################################################
 * def countTotalReadsInRegion(list readBuffers):             # <<<<<<<<<<<<<<
 *     """
 *     Count and return the total number of reads (good, bad, broken)
 */
  __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_13variantcaller_1countTotalReadsInRegion, NULL, __pyx_n_s__variantcaller); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_12, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_13variantcaller_3outputRefCall, NULL, __pyx_n_s__variantcaller); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__outputRefCall, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "variantcaller.pyx":871
 * ###################################################################################################
 * 
 * class PlatypusSingleProcess(object):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process.
 */
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));

  /* "variantcaller.pyx":875
 *     Simple class to represent a single Platypus process.
 *     """
 *     samples = None             # <<<<<<<<<<<<<<
 *     samplesByID = None
 *     samplesByBAM = None
 */
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__samples, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "variantcaller.pyx":876
 *     """
 *     samples = None
 *     samplesByID = None             # <<<<<<<<<<<<<<
 *     samplesByBAM = None
 *     bamFiles = None
 */
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__samplesByID, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "variantcaller.pyx":877
 *     samples = None
 *     samplesByID = None
 *     samplesByBAM = None             # <<<<<<<<<<<<<<
 *     bamFiles = None
 * 
 */
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__samplesByBAM, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __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 (PyObject_SetItem(__pyx_t_8, __pyx_n_s__bamFiles, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __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_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_21PlatypusSingleProcess_1__init__, 0, __pyx_n_s_86, NULL, __pyx_n_s__variantcaller, ((PyObject *)__pyx_k_codeobj_85)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_7, sizeof(__pyx_defaults), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_7)->__pyx_arg_continuing = __pyx_t_9;
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_7, __pyx_pf_13variantcaller_21PlatypusSingleProcess_4__defaults__);
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":935
 *         options.nInd = len(set(self.samples))
 * 
 *     def run(self):             # <<<<<<<<<<<<<<
 *         """
 *         Run a single Platypus process
 */
  __pyx_t_7 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_21PlatypusSingleProcess_3run, 0, __pyx_n_s_89, NULL, __pyx_n_s__variantcaller, ((PyObject *)__pyx_k_codeobj_88)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__run, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "variantcaller.pyx":871
 * ###################################################################################################
 * 
 * class PlatypusSingleProcess(object):             # <<<<<<<<<<<<<<
 *     """
 *     Simple class to represent a single Platypus process.
 */
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_8), "__doc__", ((PyObject *)__pyx_kp_s_90)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_CreateClass(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8), __pyx_n_s_75, __pyx_n_s_75, __pyx_n_s__variantcaller); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_75, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));

  /* "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_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_20PlatypusMultiProcess_1__init__, 0, __pyx_n_s_93, NULL, __pyx_n_s__variantcaller, ((PyObject *)__pyx_k_codeobj_92)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_9, sizeof(__pyx_defaults1), 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_9)->__pyx_arg_continuing = __pyx_t_7;
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_9, __pyx_pf_13variantcaller_20PlatypusMultiProcess_4__defaults__);
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s____init__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13variantcaller_20PlatypusMultiProcess_3run, 0, __pyx_n_s_96, NULL, __pyx_n_s__variantcaller, ((PyObject *)__pyx_k_codeobj_95)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_8, __pyx_n_s__run, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 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_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__multiprocessing); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__Process); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_8), "__doc__", ((PyObject *)__pyx_kp_s_97)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_CreateClass(((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_8), __pyx_n_s_98, __pyx_n_s_98, __pyx_n_s__variantcaller); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_98, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

  /* "variantcaller.pyx":1
 * """             # <<<<<<<<<<<<<<
 * This module contains the top-level variant-calling
 * code, including a VariantCaller class.
 */
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

  /* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__pyx_m) {
    __Pyx_AddTraceback("init variantcaller", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init variantcaller");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                             int is_tuple, int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    if (!is_tuple && unlikely(!PyTuple_Check(tuple))) {
        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);
    } else {
        if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) {
            __Pyx_UnpackTupleError(tuple, 2);
            goto bad;
        }
#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);
        value2 = PyTuple_GET_ITEM(tuple, 1);
        Py_INCREF(value1);
        Py_INCREF(value2);
#endif
        if (decref_tuple) { Py_DECREF(tuple); }
    }
    *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;
}

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 !CYTHON_COMPILING_IN_PYPY
    if (is_dict) {
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#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, Py_ssize_t orig_length, 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;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (DECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

#if PY_MAJOR_VERSION >= 3
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    return PyObject_CallMethodObjArgs(d, __pyx_n_s__keys, NULL);
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
        if (PyInstance_Check(type)) {
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        } else {
            type = 0;
            PyErr_SetString(PyExc_TypeError,
                "raise: exception must be an old-style class or instance");
            goto raise_error;
        }
        #else
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        } else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    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;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    PyObject* dict = PyModule_GetDict(__pyx_m);
    Py_XINCREF(dict);
    return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
    0,                                  /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
        return -1;
    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____class__);
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *qualname, PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;
    if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
        return NULL;
    if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
        return NULL;
    metaclass = PyDict_GetItem(dict, __pyx_n_s____metaclass__);
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

#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,
            "%s does not export expected C variable %s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %s.%s has wrong signature (expected %s, got %s)",
             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 %s.%s has wrong signature (expected %s, got %s)",
             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

#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,
            "%s does not export expected C function %s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             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 %s.%s has wrong signature (expected %s, got %s)",
             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

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (r < 0) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
