/* Generated by Cython 0.29.4 */

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

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

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

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


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

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

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

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

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

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


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

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


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

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

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

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

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

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

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


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


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


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


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


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


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


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


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


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


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


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


/* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */
struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding {
  PyObject_HEAD
  PyObject *__pyx_v_alt;
};


/* "vcfutils.pyx":815
 *         for i in range(1, minLenRefAlt):
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))             # <<<<<<<<<<<<<<
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))
 *             firstRefChar = ref[0].upper()
 */
struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *__pyx_outer_scope;
  PyObject *__pyx_v_allele;
};


/* "vcfutils.pyx":816
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))             # <<<<<<<<<<<<<<
 *             firstRefChar = ref[0].upper()
 * 
 */
struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *__pyx_outer_scope;
  PyObject *__pyx_v_allele;
};



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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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

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

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

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

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

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

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

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

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

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

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

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

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

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

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

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

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

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

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

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

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

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* py_dict_values.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);

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

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

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

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

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

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

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

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

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

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

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

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

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

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

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

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

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

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

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

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


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

/* Module declarations from 'cython' */

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'htslibWrapper' */
static PyTypeObject *__pyx_ptype_13htslibWrapper_Samfile = 0;
static PyTypeObject *__pyx_ptype_13htslibWrapper_ReadIterator = 0;
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReverse(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsPaired(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsProperPair(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsDuplicate(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsReverse(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsQCFail(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReadOne(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsSecondaryAlignment(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/
static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetQCFail(__pyx_t_13htslibWrapper_cAlignedRead *); /*proto*/

/* 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 '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 'cgenotype' */
static PyTypeObject *__pyx_ptype_9cgenotype_DiploidGenotype = 0;
static PyTypeObject *__pyx_ptype_9cgenotype_HaploidGenotype = 0;

/* Module declarations from 'platypusutils' */
static double (*__pyx_f_13platypusutils_binomial)(int, int, double); /*proto*/
static double (*__pyx_f_13platypusutils_betaBinomialCDF)(int, int, int, int); /*proto*/

/* Module declarations from 'vcfutils' */
static PyTypeObject *__pyx_ptype_8vcfutils___pyx_scope_struct__trimLeftPadding = 0;
static PyTypeObject *__pyx_ptype_8vcfutils___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_8vcfutils___pyx_scope_struct_2_genexpr = 0;
static double __pyx_v_8vcfutils_LOG10_E;
static int __pyx_v_8vcfutils_CIGAR_M;
static int __pyx_v_8vcfutils_CIGAR_I;
static int __pyx_v_8vcfutils_CIGAR_D;
static int __pyx_v_8vcfutils_CIGAR_N;
static int __pyx_v_8vcfutils_CIGAR_S;
static int __pyx_v_8vcfutils_CIGAR_H;
static int __pyx_v_8vcfutils_CIGAR_P;
static int __pyx_v_8vcfutils_CIGAR_EQ;
static int __pyx_v_8vcfutils_CIGAR_X;
static PyObject *__pyx_f_8vcfutils_refAndAlt(char *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *); /*proto*/
static PyObject *__pyx_f_8vcfutils_computeGenotypeCallAndLikelihoods(int, PyObject *, PyObject *, int, double *, double **, double **, int **, int **, PyObject *, int *, int, PyObject *); /*proto*/
static int __pyx_f_8vcfutils_readOverlapsVariant(__pyx_t_13htslibWrapper_cAlignedRead *, int, int); /*proto*/
static int __pyx_f_8vcfutils_readQualIsGoodVariantPosition(__pyx_t_13htslibWrapper_cAlignedRead *, int, int, int); /*proto*/
static int __pyx_f_8vcfutils_variantSupportedByRead(__pyx_t_13htslibWrapper_cAlignedRead *, int, int, struct __pyx_obj_7variant_Variant *, int); /*proto*/
static int __pyx_f_8vcfutils_computeHaplotypeScore(PyObject *); /*proto*/
static PyObject *__pyx_f_8vcfutils_getHaplotypeInfo(PyObject *, PyObject *, double *, int); /*proto*/
static double __pyx_f_8vcfutils_computeAlleleBiasPValue(int, int); /*proto*/
static double __pyx_f_8vcfutils_computeStrandBiasPValue(int, int, int, int); /*proto*/
static double __pyx_f_8vcfutils_computeSCValue(PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "vcfutils"
extern int __pyx_module_is_main_vcfutils;
int __pyx_module_is_main_vcfutils = 0;

/* Implementation of 'vcfutils' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_open;
static PyObject *__pyx_builtin_map;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_sum;
static const char __pyx_k_0[] = "0";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_G[] = "G";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_s[] = "%s\n";
static const char __pyx_k_0f[] = "%.0f";
static const char __pyx_k_FR[] = "FR";
static const char __pyx_k_FS[] = "FS";
static const char __pyx_k_GL[] = "GL";
static const char __pyx_k_GQ[] = "GQ";
static const char __pyx_k_GT[] = "GT";
static const char __pyx_k_HP[] = "HP";
static const char __pyx_k_MQ[] = "MQ";
static const char __pyx_k_NF[] = "NF";
static const char __pyx_k_NR[] = "NR";
static const char __pyx_k_NV[] = "NV";
static const char __pyx_k_PP[] = "PP";
static const char __pyx_k_QD[] = "QD";
static const char __pyx_k_SC[] = "SC";
static const char __pyx_k_TC[] = "TC";
static const char __pyx_k_TR[] = "TR";
static const char __pyx_k_WE[] = "WE";
static const char __pyx_k_WS[] = "WS";
static const char __pyx_k__2[] = ".";
static const char __pyx_k__3[] = "/";
static const char __pyx_k__4[] = "";
static const char __pyx_k__5[] = "\t";
static const char __pyx_k__6[] = ",";
static const char __pyx_k__7[] = ":";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_BRF[] = "BRF";
static const char __pyx_k_END[] = "END";
static const char __pyx_k_GOF[] = "GOF";
static const char __pyx_k_Log[] = "Log";
static const char __pyx_k_Q20[] = "Q20";
static const char __pyx_k_TCF[] = "TCF";
static const char __pyx_k_TCR[] = "TCR";
static const char __pyx_k_alt[] = "alt";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_len[] = "len";
static const char __pyx_k_map[] = "map";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_vcf[] = "vcf";
static const char __pyx_k_1_4f[] = "%1.4f";
static const char __pyx_k_ABPV[] = "ABPV";
static const char __pyx_k_File[] = "File";
static const char __pyx_k_Flag[] = "Flag";
static const char __pyx_k_MGOF[] = "MGOF";
static const char __pyx_k_MMLQ[] = "MMLQ";
static const char __pyx_k_PASS[] = "PASS";
static const char __pyx_k_Size[] = ";Size=";
static const char __pyx_k_WE_2[] = ";WE=";
static const char __pyx_k_WS_2[] = "WS=";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_hp10[] = "hp10";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_qual[] = "qual";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_Float[] = "Float";
static const char __pyx_k_START[] = "START";
static const char __pyx_k_chrom[] = "chrom";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_d_d_s[] = "%d %d %s\n";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_FORMAT[] = "FORMAT";
static const char __pyx_k_SbPval[] = "SbPval";
static const char __pyx_k_Size_2[] = "Size";
static const char __pyx_k_Source[] = "Source";
static const char __pyx_k_String[] = "String";
static const char __pyx_k_allele[] = "allele";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_filter[] = "filter";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_logger[] = "logger";
static const char __pyx_k_maxGOF[] = "maxGOF";
static const char __pyx_k_sorted[] = "sorted";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_Integer[] = "Integer";
static const char __pyx_k_REFCALL[] = "REFCALL";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_logging[] = "logging";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_refName[] = "refName";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_vcfFile[] = "vcfFile";
static const char __pyx_k_warning[] = "warning";
static const char __pyx_k_HapScore[] = "HapScore";
static const char __pyx_k_Platypus[] = "Platypus";
static const char __pyx_k_badReads[] = "badReads";
static const char __pyx_k_minReads[] = "minReads";
static const char __pyx_k_vcfutils[] = "vcfutils";
static const char __pyx_k_Assembler[] = "Assembler";
static const char __pyx_k_HLATyping[] = "HLATyping";
static const char __pyx_k_QualDepth[] = "QualDepth";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_getLogger[] = "getLogger";
static const char __pyx_k_getfilter[] = "getfilter";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_maxRefPos[] = "maxRefPos";
static const char __pyx_k_minRefPos[] = "minRefPos";
static const char __pyx_k_varSource[] = ";varSource=";
static const char __pyx_k_verbosity[] = "verbosity";
static const char __pyx_k_Haps_are_s[] = "Haps are %s";
static const char __pyx_k_Var_info_s[] = "Var info = %s";
static const char __pyx_k_alleleBias[] = "alleleBias";
static const char __pyx_k_maxLenDiff[] = "maxLenDiff";
static const char __pyx_k_minMapQual[] = "minMapQual";
static const char __pyx_k_outputFile[] = "outputFile";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_strandBias[] = "strandBias";
static const char __pyx_k_write_data[] = "write_data";
static const char __pyx_k_NVariants_s[] = "NVariants = %s";
static const char __pyx_k_abThreshold[] = "abThreshold";
static const char __pyx_k_minBaseQual[] = "minBaseQual";
static const char __pyx_k_qdThreshold[] = "qdThreshold";
static const char __pyx_k_sbThreshold[] = "sbThreshold";
static const char __pyx_k_scThreshold[] = "scThreshold";
static const char __pyx_k_vcfDataLine[] = "vcfDataLine";
static const char __pyx_k_firstRefChar[] = "firstRefChar";
static const char __pyx_k_minLenRefAlt[] = "minLenRefAlt";
static const char __pyx_k_minPosterior[] = "minPosterior";
static const char __pyx_k_Lengths_are_s[] = "Lengths are %s";
static const char __pyx_k_firstAltChars[] = "firstAltChars";
static const char __pyx_k_ReadPosRankSum[] = "ReadPosRankSum";
static const char __pyx_k_alignScoreFile[] = "alignScoreFile";
static const char __pyx_k_badReadsWindow[] = "badReadsWindow";
static const char __pyx_k_canonicalBases[] = "canonicalBases";
static const char __pyx_k_outputRefCalls[] = "outputRefCalls";
static const char __pyx_k_rmsmqThreshold[] = "rmsmqThreshold";
static const char __pyx_k_secondAltChars[] = "secondAltChars";
static const char __pyx_k_Out_vcf_writing[] = "Out vcf writing";
static const char __pyx_k_nReadsPerSample[] = "nReadsPerSample";
static const char __pyx_k_trimLeftPadding[] = "trimLeftPadding";
static const char __pyx_k_GT_GL_NR_NV1_NV2[] = "GT:GL:NR:NV1:NV2";
static const char __pyx_k_vcfInfoSignature[] = "vcfInfoSignature";
static const char __pyx_k_badReadsThreshold[] = "badReadsThreshold";
static const char __pyx_k_filteredReadsFrac[] = "filteredReadsFrac";
static const char __pyx_k_hapScoreThreshold[] = "hapScoreThreshold";
static const char __pyx_k_GT_GL_GOF_GQ_NR_NV[] = "GT:GL:GOF:GQ:NR:NV";
static const char __pyx_k_Unphased_genotypes[] = "Unphased genotypes";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_nVarReadsPerSample[] = "nVarReadsPerSample";
static const char __pyx_k_vcfFilterSignature[] = "vcfFilterSignature";
static const char __pyx_k_vcfFormatSignature[] = "vcfFormatSignature";
static const char __pyx_k_Start_output_to_vcf[] = "Start output to vcf";
static const char __pyx_k_cython_vcfutils_pyx[] = "cython/vcfutils.pyx";
static const char __pyx_k_Individual_d_d_d_d_d[] = "Individual\t%d\t%d\t%d:%d-%d\n";
static const char __pyx_k_Goodness_of_fit_value[] = "Goodness of fit value";
static const char __pyx_k_outputSingleLineOfVCF[] = "outputSingleLineOfVCF";
static const char __pyx_k_Logging_mutated_sequences[] = "Logging mutated sequences...";
static const char __pyx_k_Unfiltered_variants_are_s[] = "Unfiltered variants are %s";
static const char __pyx_k_countOnlyExactIndelMatches[] = "countOnlyExactIndelMatches";
static const char __pyx_k_Variant_quality_is_below_20[] = "Variant quality is below 20.";
static const char __pyx_k_Size_of_reference_call_block[] = "Size of reference call block";
static const char __pyx_k_Total_coverage_at_this_locus[] = "Total coverage at this locus";
static const char __pyx_k_Unfiltered_variant_info_is_s[] = "Unfiltered variant info is %s";
static const char __pyx_k_End_position_of_calling_window[] = "End position of calling window";
static const char __pyx_k_Utility_code_for_Platypus_This[] = "\nUtility code for Platypus. This is mostly concerned with processing needed to produce\nVCF output from the various data structures used by Platypus.\n";
static const char __pyx_k_trimLeftPadding_locals_genexpr[] = "trimLeftPadding.<locals>.genexpr";
static const char __pyx_k_Genotype_quality_as_phred_score[] = "Genotype quality as phred score";
static const char __pyx_k_Median_minimum_base_quality_for[] = "Median minimum base quality for bases around variant";
static const char __pyx_k_Sample_s_has_genotype_posterior[] = "Sample %s has genotype posterior = %s. non-ref posterior = %s. Ref posterior = %s.";
static const char __pyx_k_Variant_frequency_is_lower_than[] = "Variant frequency is lower than expected for het";
static const char __pyx_k_Variant_supported_only_by_reads[] = "Variant supported only by reads with low quality bases close to variant position, and not present on both strands.";
static const char __pyx_k_Binomial_P_value_for_strand_bias[] = "Binomial P-value for strand bias test";
static const char __pyx_k_End_position_of_reference_call_b[] = "End position of reference call block";
static const char __pyx_k_Estimated_population_frequency_o[] = "Estimated population frequency of variant";
static const char __pyx_k_Fisher_s_exact_test_for_strand_b[] = "Fisher's exact test for strand bias (Phred scale)";
static const char __pyx_k_Flanking_sequence_contains_homop[] = "Flanking sequence contains homopolymer of length 10 or greater";
static const char __pyx_k_Fraction_of_reads_around_this_va[] = "Fraction of reads around this variant that failed filters";
static const char __pyx_k_Genomic_sequence_10_bases_either[] = "Genomic sequence 10 bases either side of variant position";
static const char __pyx_k_Genotype_log10_likelihoods_for_A[] = "Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites";
static const char __pyx_k_Haplotype_score_measuring_the_nu[] = "Haplotype score measuring the number of haplotypes the variant is segregating into in a window";
static const char __pyx_k_Homopolymer_run_length_around_va[] = "Homopolymer run length around variant locus";
static const char __pyx_k_Mann_Whitney_Rank_sum_test_for_d[] = "Mann-Whitney Rank sum test for difference between in positions of variants in reads from ref and alt";
static const char __pyx_k_Number_of_reads_containing_varia[] = "Number of reads containing variant in this sample";
static const char __pyx_k_Number_of_reads_covering_variant[] = "Number of reads covering variant location in this sample";
static const char __pyx_k_Posterior_probability_phred_scal[] = "Posterior probability (phred scaled) that this variant segregates";
static const char __pyx_k_Root_mean_square_mapping_quality[] = "Root-mean-square mapping quality across calling region is low.";
static const char __pyx_k_Root_mean_square_of_mapping_qual[] = "Root mean square of mapping qualities of reads at the variant position";
static const char __pyx_k_Skipping_output_for_call_s_s_s_s[] = "Skipping output for call %s:%s %s --> %s, as the reference sequence contains non-canonical bases (i.e. not A,C,T,G)";
static const char __pyx_k_Start_position_of_reference_call[] = "Start position of reference call block";
static const char __pyx_k_Starting_position_of_calling_win[] = "Starting position of calling window";
static const char __pyx_k_This_line_represents_a_homozygou[] = "This line represents a homozygous reference call";
static const char __pyx_k_Too_many_haplotypes_are_supporte[] = "Too many haplotypes are supported by the data in this region.";
static const char __pyx_k_Total_forward_strand_coverage_at[] = "Total forward strand coverage at this locus";
static const char __pyx_k_Total_number_of_forward_reads_co[] = "Total number of forward reads containing this variant";
static const char __pyx_k_Total_number_of_reads_containing[] = "Total number of reads containing this variant";
static const char __pyx_k_Total_number_of_reverse_reads_co[] = "Total number of reverse reads containing this variant";
static const char __pyx_k_Total_reverse_strand_coverage_at[] = "Total reverse strand coverage at this locus";
static const char __pyx_k_Variant_fails_goodness_of_fit_te[] = "Variant fails goodness-of-fit test.";
static const char __pyx_k_Variant_fails_strand_bias_filter[] = "Variant fails strand-bias filter";
static const char __pyx_k_Variant_quality_Read_depth_ratio[] = "Variant quality/Read depth ratio is low.";
static const char __pyx_k_Variant_quality_read_depth_for_t[] = "Variant-quality/read-depth for this variant";
static const char __pyx_k_Variants_fail_quality_depth_filt[] = "Variants fail quality/depth filter.";
static const char __pyx_k_Variants_fail_sequence_context_f[] = "Variants fail sequence-context filter. Surrounding sequence is low-complexity";
static const char __pyx_k_Was_this_variant_suggested_by_Pl[] = "Was this variant suggested by Playtypus, Assembler, or from a VCF?";
static const char __pyx_k_Worst_goodness_of_fit_value_repo[] = "Worst goodness-of-fit value reported across all samples";
static PyObject *__pyx_kp_s_0;
static PyObject *__pyx_kp_s_0f;
static PyObject *__pyx_kp_s_1_4f;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_ABPV;
static PyObject *__pyx_n_s_Assembler;
static PyObject *__pyx_n_s_BRF;
static PyObject *__pyx_kp_s_Binomial_P_value_for_strand_bias;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_END;
static PyObject *__pyx_kp_s_End_position_of_calling_window;
static PyObject *__pyx_kp_s_End_position_of_reference_call_b;
static PyObject *__pyx_kp_s_Estimated_population_frequency_o;
static PyObject *__pyx_n_s_FORMAT;
static PyObject *__pyx_n_s_FR;
static PyObject *__pyx_n_s_FS;
static PyObject *__pyx_n_s_File;
static PyObject *__pyx_kp_s_Fisher_s_exact_test_for_strand_b;
static PyObject *__pyx_n_s_Flag;
static PyObject *__pyx_kp_s_Flanking_sequence_contains_homop;
static PyObject *__pyx_n_s_Float;
static PyObject *__pyx_kp_s_Fraction_of_reads_around_this_va;
static PyObject *__pyx_n_s_G;
static PyObject *__pyx_n_s_GL;
static PyObject *__pyx_n_s_GOF;
static PyObject *__pyx_n_s_GQ;
static PyObject *__pyx_n_s_GT;
static PyObject *__pyx_kp_s_GT_GL_GOF_GQ_NR_NV;
static PyObject *__pyx_kp_s_GT_GL_NR_NV1_NV2;
static PyObject *__pyx_kp_s_Genomic_sequence_10_bases_either;
static PyObject *__pyx_kp_s_Genotype_log10_likelihoods_for_A;
static PyObject *__pyx_kp_s_Genotype_quality_as_phred_score;
static PyObject *__pyx_kp_s_Goodness_of_fit_value;
static PyObject *__pyx_n_s_HLATyping;
static PyObject *__pyx_n_s_HP;
static PyObject *__pyx_n_s_HapScore;
static PyObject *__pyx_kp_s_Haplotype_score_measuring_the_nu;
static PyObject *__pyx_kp_s_Haps_are_s;
static PyObject *__pyx_kp_s_Homopolymer_run_length_around_va;
static PyObject *__pyx_kp_s_Individual_d_d_d_d_d;
static PyObject *__pyx_n_s_Integer;
static PyObject *__pyx_kp_s_Lengths_are_s;
static PyObject *__pyx_n_s_Log;
static PyObject *__pyx_kp_s_Logging_mutated_sequences;
static PyObject *__pyx_n_s_MGOF;
static PyObject *__pyx_n_s_MMLQ;
static PyObject *__pyx_n_s_MQ;
static PyObject *__pyx_kp_s_Mann_Whitney_Rank_sum_test_for_d;
static PyObject *__pyx_kp_s_Median_minimum_base_quality_for;
static PyObject *__pyx_n_s_NF;
static PyObject *__pyx_n_s_NR;
static PyObject *__pyx_n_s_NV;
static PyObject *__pyx_kp_s_NVariants_s;
static PyObject *__pyx_kp_s_Number_of_reads_containing_varia;
static PyObject *__pyx_kp_s_Number_of_reads_covering_variant;
static PyObject *__pyx_kp_s_Out_vcf_writing;
static PyObject *__pyx_n_s_PASS;
static PyObject *__pyx_n_s_PP;
static PyObject *__pyx_n_s_Platypus;
static PyObject *__pyx_kp_s_Posterior_probability_phred_scal;
static PyObject *__pyx_n_s_Q20;
static PyObject *__pyx_n_s_QD;
static PyObject *__pyx_n_s_QualDepth;
static PyObject *__pyx_n_s_REFCALL;
static PyObject *__pyx_n_s_ReadPosRankSum;
static PyObject *__pyx_kp_s_Root_mean_square_mapping_quality;
static PyObject *__pyx_kp_s_Root_mean_square_of_mapping_qual;
static PyObject *__pyx_n_s_SC;
static PyObject *__pyx_n_s_START;
static PyObject *__pyx_kp_s_Sample_s_has_genotype_posterior;
static PyObject *__pyx_n_s_SbPval;
static PyObject *__pyx_kp_s_Size;
static PyObject *__pyx_n_s_Size_2;
static PyObject *__pyx_kp_s_Size_of_reference_call_block;
static PyObject *__pyx_kp_s_Skipping_output_for_call_s_s_s_s;
static PyObject *__pyx_n_s_Source;
static PyObject *__pyx_kp_s_Start_output_to_vcf;
static PyObject *__pyx_kp_s_Start_position_of_reference_call;
static PyObject *__pyx_kp_s_Starting_position_of_calling_win;
static PyObject *__pyx_n_s_String;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_TC;
static PyObject *__pyx_n_s_TCF;
static PyObject *__pyx_n_s_TCR;
static PyObject *__pyx_n_s_TR;
static PyObject *__pyx_kp_s_This_line_represents_a_homozygou;
static PyObject *__pyx_kp_s_Too_many_haplotypes_are_supporte;
static PyObject *__pyx_kp_s_Total_coverage_at_this_locus;
static PyObject *__pyx_kp_s_Total_forward_strand_coverage_at;
static PyObject *__pyx_kp_s_Total_number_of_forward_reads_co;
static PyObject *__pyx_kp_s_Total_number_of_reads_containing;
static PyObject *__pyx_kp_s_Total_number_of_reverse_reads_co;
static PyObject *__pyx_kp_s_Total_reverse_strand_coverage_at;
static PyObject *__pyx_kp_s_Unfiltered_variant_info_is_s;
static PyObject *__pyx_kp_s_Unfiltered_variants_are_s;
static PyObject *__pyx_kp_s_Unphased_genotypes;
static PyObject *__pyx_kp_s_Var_info_s;
static PyObject *__pyx_kp_s_Variant_fails_goodness_of_fit_te;
static PyObject *__pyx_kp_s_Variant_fails_strand_bias_filter;
static PyObject *__pyx_kp_s_Variant_frequency_is_lower_than;
static PyObject *__pyx_kp_s_Variant_quality_Read_depth_ratio;
static PyObject *__pyx_kp_s_Variant_quality_is_below_20;
static PyObject *__pyx_kp_s_Variant_quality_read_depth_for_t;
static PyObject *__pyx_kp_s_Variant_supported_only_by_reads;
static PyObject *__pyx_kp_s_Variants_fail_quality_depth_filt;
static PyObject *__pyx_kp_s_Variants_fail_sequence_context_f;
static PyObject *__pyx_n_s_WE;
static PyObject *__pyx_kp_s_WE_2;
static PyObject *__pyx_n_s_WS;
static PyObject *__pyx_kp_s_WS_2;
static PyObject *__pyx_kp_s_Was_this_variant_suggested_by_Pl;
static PyObject *__pyx_kp_s_Worst_goodness_of_fit_value_repo;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_kp_s__4;
static PyObject *__pyx_kp_s__5;
static PyObject *__pyx_kp_s__6;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_abThreshold;
static PyObject *__pyx_n_s_alignScoreFile;
static PyObject *__pyx_n_s_allele;
static PyObject *__pyx_n_s_alleleBias;
static PyObject *__pyx_n_s_alt;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_badReads;
static PyObject *__pyx_n_s_badReadsThreshold;
static PyObject *__pyx_n_s_badReadsWindow;
static PyObject *__pyx_n_s_canonicalBases;
static PyObject *__pyx_n_s_chrom;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_countOnlyExactIndelMatches;
static PyObject *__pyx_kp_s_cython_vcfutils_pyx;
static PyObject *__pyx_kp_s_d_d_s;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_filter;
static PyObject *__pyx_n_s_filteredReadsFrac;
static PyObject *__pyx_n_s_firstAltChars;
static PyObject *__pyx_n_s_firstRefChar;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_getLogger;
static PyObject *__pyx_n_s_getfilter;
static PyObject *__pyx_n_s_hapScoreThreshold;
static PyObject *__pyx_n_s_hp10;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_n_s_logger;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_map;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_maxGOF;
static PyObject *__pyx_n_s_maxLenDiff;
static PyObject *__pyx_n_s_maxRefPos;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_minBaseQual;
static PyObject *__pyx_n_s_minLenRefAlt;
static PyObject *__pyx_n_s_minMapQual;
static PyObject *__pyx_n_s_minPosterior;
static PyObject *__pyx_n_s_minReads;
static PyObject *__pyx_n_s_minRefPos;
static PyObject *__pyx_n_s_nReadsPerSample;
static PyObject *__pyx_n_s_nVarReadsPerSample;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_open;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_outputFile;
static PyObject *__pyx_n_s_outputRefCalls;
static PyObject *__pyx_n_s_outputSingleLineOfVCF;
static PyObject *__pyx_n_s_pop;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qdThreshold;
static PyObject *__pyx_n_s_qual;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_ref;
static PyObject *__pyx_n_s_refName;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_rmsmqThreshold;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_n_s_sbThreshold;
static PyObject *__pyx_n_s_scThreshold;
static PyObject *__pyx_n_s_secondAltChars;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_sorted;
static PyObject *__pyx_n_s_strandBias;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_trimLeftPadding;
static PyObject *__pyx_n_s_trimLeftPadding_locals_genexpr;
static PyObject *__pyx_n_s_upper;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_kp_s_varSource;
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_vcfInfoSignature;
static PyObject *__pyx_n_s_vcfutils;
static PyObject *__pyx_n_s_verbosity;
static PyObject *__pyx_n_s_warning;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_write_data;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_pf_8vcfutils_outputSingleLineOfVCF(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_vcfFile, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_8vcfutils_15trimLeftPadding_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_8vcfutils_15trimLeftPadding_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_8vcfutils_2trimLeftPadding(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vcfDataLine); /* proto */
static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct__trimLeftPadding(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values = {0, &__pyx_n_s_values, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyList_Type_index = {0, &__pyx_n_s_index, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_2_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_50;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_50;
static PyObject *__pyx_slice_;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_slice__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__57;
/* Late includes */

/* "vcfutils.pyx":127
 * ###################################################################################################
 * 
 * def outputSingleLineOfVCF(dict data, object outputFile, object vcfFile, options):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

/* Python wrapper */
static PyObject *__pyx_pw_8vcfutils_1outputSingleLineOfVCF(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8vcfutils_outputSingleLineOfVCF[] = "\n    ";
static PyMethodDef __pyx_mdef_8vcfutils_1outputSingleLineOfVCF = {"outputSingleLineOfVCF", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8vcfutils_1outputSingleLineOfVCF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8vcfutils_outputSingleLineOfVCF};
static PyObject *__pyx_pw_8vcfutils_1outputSingleLineOfVCF(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_outputFile = 0;
  PyObject *__pyx_v_vcfFile = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outputSingleLineOfVCF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_outputFile,&__pyx_n_s_vcfFile,&__pyx_n_s_options,0};
    PyObject* values[4] = {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  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outputFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputSingleLineOfVCF", 1, 4, 4, 1); __PYX_ERR(0, 127, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vcfFile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputSingleLineOfVCF", 1, 4, 4, 2); __PYX_ERR(0, 127, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outputSingleLineOfVCF", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outputSingleLineOfVCF") < 0)) __PYX_ERR(0, 127, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      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);
    }
    __pyx_v_data = ((PyObject*)values[0]);
    __pyx_v_outputFile = values[1];
    __pyx_v_vcfFile = values[2];
    __pyx_v_options = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outputSingleLineOfVCF", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("vcfutils.outputSingleLineOfVCF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyDict_Type), 1, "data", 1))) __PYX_ERR(0, 127, __pyx_L1_error)
  __pyx_r = __pyx_pf_8vcfutils_outputSingleLineOfVCF(__pyx_self, __pyx_v_data, __pyx_v_outputFile, __pyx_v_vcfFile, __pyx_v_options);

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

static PyObject *__pyx_pf_8vcfutils_outputSingleLineOfVCF(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_vcfFile, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("outputSingleLineOfVCF", 0);

  /* "vcfutils.pyx":133
 *     # Write variant call info to VCF file.
 * 
 *     vcfFile.write_data(outputFile, data)             # <<<<<<<<<<<<<<
 * 
 *     #theChrom = data['chrom']
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_vcfFile, __pyx_n_s_write_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_outputFile, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_outputFile, __pyx_v_data};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_outputFile);
    __Pyx_GIVEREF(__pyx_v_outputFile);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_outputFile);
    __Pyx_INCREF(__pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_data);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":127
 * ###################################################################################################
 * 
 * def outputSingleLineOfVCF(dict data, object outputFile, object vcfFile, options):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("vcfutils.outputSingleLineOfVCF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":147
 * ###################################################################################################
 * 
 * cdef int testGenotype(Variant var, int hapIsRefAtVarPos, set varsInHap):             # <<<<<<<<<<<<<<
 * 
 *     if var is None:
 */

static int __pyx_f_8vcfutils_testGenotype(struct __pyx_obj_7variant_Variant *__pyx_v_var, int __pyx_v_hapIsRefAtVarPos, PyObject *__pyx_v_varsInHap) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("testGenotype", 0);

  /* "vcfutils.pyx":149
 * cdef int testGenotype(Variant var, int hapIsRefAtVarPos, set varsInHap):
 * 
 *     if var is None:             # <<<<<<<<<<<<<<
 * 
 *         if hapIsRefAtVarPos:
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_var) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "vcfutils.pyx":151
 *     if var is None:
 * 
 *         if hapIsRefAtVarPos:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    __pyx_t_2 = (__pyx_v_hapIsRefAtVarPos != 0);
    if (__pyx_t_2) {

      /* "vcfutils.pyx":152
 * 
 *         if hapIsRefAtVarPos:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "vcfutils.pyx":151
 *     if var is None:
 * 
 *         if hapIsRefAtVarPos:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    }

    /* "vcfutils.pyx":154
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 *     else:
 *         if var in varsInHap:
 */
    /*else*/ {
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "vcfutils.pyx":149
 * cdef int testGenotype(Variant var, int hapIsRefAtVarPos, set varsInHap):
 * 
 *     if var is None:             # <<<<<<<<<<<<<<
 * 
 *         if hapIsRefAtVarPos:
 */
  }

  /* "vcfutils.pyx":156
 *             return False
 *     else:
 *         if var in varsInHap:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  /*else*/ {
    if (unlikely(__pyx_v_varsInHap == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 156, __pyx_L1_error)
    }
    __pyx_t_2 = (__Pyx_PySet_ContainsTF(((PyObject *)__pyx_v_var), __pyx_v_varsInHap, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 156, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":157
 *     else:
 *         if var in varsInHap:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
      __pyx_r = 1;
      goto __pyx_L0;

      /* "vcfutils.pyx":156
 *             return False
 *     else:
 *         if var in varsInHap:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    }

    /* "vcfutils.pyx":159
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
    /*else*/ {
      __pyx_r = 0;
      goto __pyx_L0;
    }
  }

  /* "vcfutils.pyx":147
 * ###################################################################################################
 * 
 * cdef int testGenotype(Variant var, int hapIsRefAtVarPos, set varsInHap):             # <<<<<<<<<<<<<<
 * 
 *     if var is None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("vcfutils.testGenotype", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":163
 * ###################################################################################################
 * 
 * cdef tuple computeGenotypeCallAndLikelihoods(int variantPosition, list haplotypes, list genotypes, int sampleIndex, double* haplotypeFrequencies, double** genotypeLikelihoods, double** gofValues, int** haplotypeIndexes, int** varInHap, list variantsThisPos, int* haplotypeIsRefAtThisPos, int nIndividuals, thisSample):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

static PyObject *__pyx_f_8vcfutils_computeGenotypeCallAndLikelihoods(CYTHON_UNUSED int __pyx_v_variantPosition, PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_genotypes, int __pyx_v_sampleIndex, double *__pyx_v_haplotypeFrequencies, double **__pyx_v_genotypeLikelihoods, double **__pyx_v_gofValues, int **__pyx_v_haplotypeIndexes, int **__pyx_v_varInHap, PyObject *__pyx_v_variantsThisPos, int *__pyx_v_haplotypeIsRefAtThisPos, int __pyx_v_nIndividuals, CYTHON_UNUSED PyObject *__pyx_v_thisSample) {
  double __pyx_v_marginalGenotypeLikelihood;
  double __pyx_v_currentLikelihood;
  double __pyx_v_sumLikelihoods;
  double __pyx_v_factor;
  double __pyx_v_bestGoodnessOfFitValue;
  double __pyx_v_haplotypeFrequency1;
  double __pyx_v_haplotypeFrequency2;
  double __pyx_v_bestLikelihood;
  double __pyx_v_nonRefPosterior;
  double __pyx_v_refPosterior;
  CYTHON_UNUSED int __pyx_v_bestVarIndex1;
  CYTHON_UNUSED int __pyx_v_bestVarIndex2;
  int __pyx_v_index1;
  int __pyx_v_index2;
  int __pyx_v_genotypeIndex;
  int __pyx_v_hap1Index;
  int __pyx_v_hap2Index;
  int __pyx_v_hap1IsRefAtVarPos;
  int __pyx_v_hap2IsRefAtVarPos;
  CYTHON_UNUSED struct __pyx_obj_9cgenotype_DiploidGenotype *__pyx_v_genotype = 0;
  CYTHON_UNUSED struct __pyx_obj_7variant_Variant *__pyx_v_variant = 0;
  CYTHON_UNUSED struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap2 = 0;
  PyObject *__pyx_v_likelihoods = 0;
  int __pyx_v_matchingGenotype;
  int __pyx_v_var1InHap1;
  int __pyx_v_var1InHap2;
  int __pyx_v_var2InHap1;
  int __pyx_v_var2InHap2;
  int __pyx_v_nVariants;
  int __pyx_v_nGenotypes;
  CYTHON_UNUSED int __pyx_v_nHaplotypes;
  int __pyx_v_phasedIndex1;
  int __pyx_v_phasedIndex2;
  double __pyx_v_phasedMaxLike;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  long __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  long __pyx_t_6;
  long __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  __Pyx_RefNannySetupContext("computeGenotypeCallAndLikelihoods", 0);

  /* "vcfutils.pyx":170
 *     # in VCF.
 * 
 *     cdef double marginalGenotypeLikelihood = 0.0             # <<<<<<<<<<<<<<
 *     cdef double currentLikelihood = 0.0
 *     cdef double sumLikelihoods = 0.0
 */
  __pyx_v_marginalGenotypeLikelihood = 0.0;

  /* "vcfutils.pyx":171
 * 
 *     cdef double marginalGenotypeLikelihood = 0.0
 *     cdef double currentLikelihood = 0.0             # <<<<<<<<<<<<<<
 *     cdef double sumLikelihoods = 0.0
 *     cdef double factor = 0.0
 */
  __pyx_v_currentLikelihood = 0.0;

  /* "vcfutils.pyx":172
 *     cdef double marginalGenotypeLikelihood = 0.0
 *     cdef double currentLikelihood = 0.0
 *     cdef double sumLikelihoods = 0.0             # <<<<<<<<<<<<<<
 *     cdef double factor = 0.0
 *     cdef double bestGoodnessOfFitValue = 1e6
 */
  __pyx_v_sumLikelihoods = 0.0;

  /* "vcfutils.pyx":173
 *     cdef double currentLikelihood = 0.0
 *     cdef double sumLikelihoods = 0.0
 *     cdef double factor = 0.0             # <<<<<<<<<<<<<<
 *     cdef double bestGoodnessOfFitValue = 1e6
 *     cdef double haplotypeFrequency1 = 1.0 # Leave as 1.0 until we fix the EM calculations
 */
  __pyx_v_factor = 0.0;

  /* "vcfutils.pyx":174
 *     cdef double sumLikelihoods = 0.0
 *     cdef double factor = 0.0
 *     cdef double bestGoodnessOfFitValue = 1e6             # <<<<<<<<<<<<<<
 *     cdef double haplotypeFrequency1 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double haplotypeFrequency2 = 1.0 # Leave as 1.0 until we fix the EM calculations
 */
  __pyx_v_bestGoodnessOfFitValue = 1e6;

  /* "vcfutils.pyx":175
 *     cdef double factor = 0.0
 *     cdef double bestGoodnessOfFitValue = 1e6
 *     cdef double haplotypeFrequency1 = 1.0 # Leave as 1.0 until we fix the EM calculations             # <<<<<<<<<<<<<<
 *     cdef double haplotypeFrequency2 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double bestLikelihood = -1.0
 */
  __pyx_v_haplotypeFrequency1 = 1.0;

  /* "vcfutils.pyx":176
 *     cdef double bestGoodnessOfFitValue = 1e6
 *     cdef double haplotypeFrequency1 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double haplotypeFrequency2 = 1.0 # Leave as 1.0 until we fix the EM calculations             # <<<<<<<<<<<<<<
 *     cdef double bestLikelihood = -1.0
 *     cdef double nonRefPosterior = 0.0 # Sum of 1/0 and 1/1 posteriors for bi-allelic sites
 */
  __pyx_v_haplotypeFrequency2 = 1.0;

  /* "vcfutils.pyx":177
 *     cdef double haplotypeFrequency1 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double haplotypeFrequency2 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double bestLikelihood = -1.0             # <<<<<<<<<<<<<<
 *     cdef double nonRefPosterior = 0.0 # Sum of 1/0 and 1/1 posteriors for bi-allelic sites
 *     cdef double refPosterior = 0.0 # 0/0 posterior for bi-allelic sites
 */
  __pyx_v_bestLikelihood = -1.0;

  /* "vcfutils.pyx":178
 *     cdef double haplotypeFrequency2 = 1.0 # Leave as 1.0 until we fix the EM calculations
 *     cdef double bestLikelihood = -1.0
 *     cdef double nonRefPosterior = 0.0 # Sum of 1/0 and 1/1 posteriors for bi-allelic sites             # <<<<<<<<<<<<<<
 *     cdef double refPosterior = 0.0 # 0/0 posterior for bi-allelic sites
 *     cdef int bestVarIndex1 = -1
 */
  __pyx_v_nonRefPosterior = 0.0;

  /* "vcfutils.pyx":179
 *     cdef double bestLikelihood = -1.0
 *     cdef double nonRefPosterior = 0.0 # Sum of 1/0 and 1/1 posteriors for bi-allelic sites
 *     cdef double refPosterior = 0.0 # 0/0 posterior for bi-allelic sites             # <<<<<<<<<<<<<<
 *     cdef int bestVarIndex1 = -1
 *     cdef int bestVarIndex2 = -1
 */
  __pyx_v_refPosterior = 0.0;

  /* "vcfutils.pyx":180
 *     cdef double nonRefPosterior = 0.0 # Sum of 1/0 and 1/1 posteriors for bi-allelic sites
 *     cdef double refPosterior = 0.0 # 0/0 posterior for bi-allelic sites
 *     cdef int bestVarIndex1 = -1             # <<<<<<<<<<<<<<
 *     cdef int bestVarIndex2 = -1
 *     cdef int index1,index2,genotypeIndex,hap1Index,hap2Index = -1
 */
  __pyx_v_bestVarIndex1 = -1;

  /* "vcfutils.pyx":181
 *     cdef double refPosterior = 0.0 # 0/0 posterior for bi-allelic sites
 *     cdef int bestVarIndex1 = -1
 *     cdef int bestVarIndex2 = -1             # <<<<<<<<<<<<<<
 *     cdef int index1,index2,genotypeIndex,hap1Index,hap2Index = -1
 *     cdef int hap1IsRefAtVarPos = -1
 */
  __pyx_v_bestVarIndex2 = -1;

  /* "vcfutils.pyx":182
 *     cdef int bestVarIndex1 = -1
 *     cdef int bestVarIndex2 = -1
 *     cdef int index1,index2,genotypeIndex,hap1Index,hap2Index = -1             # <<<<<<<<<<<<<<
 *     cdef int hap1IsRefAtVarPos = -1
 *     cdef int hap2IsRefAtVarPos = -1
 */
  __pyx_v_hap2Index = -1;

  /* "vcfutils.pyx":183
 *     cdef int bestVarIndex2 = -1
 *     cdef int index1,index2,genotypeIndex,hap1Index,hap2Index = -1
 *     cdef int hap1IsRefAtVarPos = -1             # <<<<<<<<<<<<<<
 *     cdef int hap2IsRefAtVarPos = -1
 * 
 */
  __pyx_v_hap1IsRefAtVarPos = -1;

  /* "vcfutils.pyx":184
 *     cdef int index1,index2,genotypeIndex,hap1Index,hap2Index = -1
 *     cdef int hap1IsRefAtVarPos = -1
 *     cdef int hap2IsRefAtVarPos = -1             # <<<<<<<<<<<<<<
 * 
 *     cdef DiploidGenotype genotype = None
 */
  __pyx_v_hap2IsRefAtVarPos = -1;

  /* "vcfutils.pyx":186
 *     cdef int hap2IsRefAtVarPos = -1
 * 
 *     cdef DiploidGenotype genotype = None             # <<<<<<<<<<<<<<
 *     cdef Variant var1,var2,variant = None
 *     cdef Haplotype haplotype,hap1,hap2 = None
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_genotype = ((struct __pyx_obj_9cgenotype_DiploidGenotype *)Py_None);

  /* "vcfutils.pyx":187
 * 
 *     cdef DiploidGenotype genotype = None
 *     cdef Variant var1,var2,variant = None             # <<<<<<<<<<<<<<
 *     cdef Haplotype haplotype,hap1,hap2 = None
 *     cdef list likelihoods = []
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_variant = ((struct __pyx_obj_7variant_Variant *)Py_None);

  /* "vcfutils.pyx":188
 *     cdef DiploidGenotype genotype = None
 *     cdef Variant var1,var2,variant = None
 *     cdef Haplotype haplotype,hap1,hap2 = None             # <<<<<<<<<<<<<<
 *     cdef list likelihoods = []
 *     cdef set varsHap1
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_hap2 = ((struct __pyx_obj_10chaplotype_Haplotype *)Py_None);

  /* "vcfutils.pyx":189
 *     cdef Variant var1,var2,variant = None
 *     cdef Haplotype haplotype,hap1,hap2 = None
 *     cdef list likelihoods = []             # <<<<<<<<<<<<<<
 *     cdef set varsHap1
 *     cdef set varsHap2
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_likelihoods = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":193
 *     cdef set varsHap2
 * 
 *     cdef bint matchingGenotype = False             # <<<<<<<<<<<<<<
 *     cdef bint var1InHap1 = False
 *     cdef bint var1InHap2 = False
 */
  __pyx_v_matchingGenotype = 0;

  /* "vcfutils.pyx":194
 * 
 *     cdef bint matchingGenotype = False
 *     cdef bint var1InHap1 = False             # <<<<<<<<<<<<<<
 *     cdef bint var1InHap2 = False
 *     cdef bint var2InHap1 = False
 */
  __pyx_v_var1InHap1 = 0;

  /* "vcfutils.pyx":195
 *     cdef bint matchingGenotype = False
 *     cdef bint var1InHap1 = False
 *     cdef bint var1InHap2 = False             # <<<<<<<<<<<<<<
 *     cdef bint var2InHap1 = False
 *     cdef bint var2InHap2 = False
 */
  __pyx_v_var1InHap2 = 0;

  /* "vcfutils.pyx":196
 *     cdef bint var1InHap1 = False
 *     cdef bint var1InHap2 = False
 *     cdef bint var2InHap1 = False             # <<<<<<<<<<<<<<
 *     cdef bint var2InHap2 = False
 * 
 */
  __pyx_v_var2InHap1 = 0;

  /* "vcfutils.pyx":197
 *     cdef bint var1InHap2 = False
 *     cdef bint var2InHap1 = False
 *     cdef bint var2InHap2 = False             # <<<<<<<<<<<<<<
 * 
 *     cdef int nVariants = len(variantsThisPos)
 */
  __pyx_v_var2InHap2 = 0;

  /* "vcfutils.pyx":199
 *     cdef bint var2InHap2 = False
 * 
 *     cdef int nVariants = len(variantsThisPos)             # <<<<<<<<<<<<<<
 *     cdef int nGenotypes = len(genotypes)
 *     cdef int nHaplotypes = len(haplotypes)
 */
  if (unlikely(__pyx_v_variantsThisPos == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 199, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_variantsThisPos); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_v_nVariants = __pyx_t_2;

  /* "vcfutils.pyx":200
 * 
 *     cdef int nVariants = len(variantsThisPos)
 *     cdef int nGenotypes = len(genotypes)             # <<<<<<<<<<<<<<
 *     cdef int nHaplotypes = len(haplotypes)
 * 
 */
  if (unlikely(__pyx_v_genotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 200, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_genotypes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 200, __pyx_L1_error)
  __pyx_v_nGenotypes = __pyx_t_2;

  /* "vcfutils.pyx":201
 *     cdef int nVariants = len(variantsThisPos)
 *     cdef int nGenotypes = len(genotypes)
 *     cdef int nHaplotypes = len(haplotypes)             # <<<<<<<<<<<<<<
 * 
 *     cdef int phasedIndex1 = -1
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 201, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 201, __pyx_L1_error)
  __pyx_v_nHaplotypes = __pyx_t_2;

  /* "vcfutils.pyx":203
 *     cdef int nHaplotypes = len(haplotypes)
 * 
 *     cdef int phasedIndex1 = -1             # <<<<<<<<<<<<<<
 *     cdef int phasedIndex2 = -1
 *     cdef double phasedMaxLike = -1e6
 */
  __pyx_v_phasedIndex1 = -1;

  /* "vcfutils.pyx":204
 * 
 *     cdef int phasedIndex1 = -1
 *     cdef int phasedIndex2 = -1             # <<<<<<<<<<<<<<
 *     cdef double phasedMaxLike = -1e6
 * 
 */
  __pyx_v_phasedIndex2 = -1;

  /* "vcfutils.pyx":205
 *     cdef int phasedIndex1 = -1
 *     cdef int phasedIndex2 = -1
 *     cdef double phasedMaxLike = -1e6             # <<<<<<<<<<<<<<
 * 
 *     for index1 in range(nVariants + 1):
 */
  __pyx_v_phasedMaxLike = -1e6;

  /* "vcfutils.pyx":207
 *     cdef double phasedMaxLike = -1e6
 * 
 *     for index1 in range(nVariants + 1):             # <<<<<<<<<<<<<<
 *         for index2 in range(nVariants + 1):
 * 
 */
  __pyx_t_3 = (__pyx_v_nVariants + 1);
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_index1 = __pyx_t_5;

    /* "vcfutils.pyx":208
 * 
 *     for index1 in range(nVariants + 1):
 *         for index2 in range(nVariants + 1):             # <<<<<<<<<<<<<<
 * 
 *             if index2 > index1:
 */
    __pyx_t_6 = (__pyx_v_nVariants + 1);
    __pyx_t_7 = __pyx_t_6;
    for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
      __pyx_v_index2 = __pyx_t_8;

      /* "vcfutils.pyx":210
 *         for index2 in range(nVariants + 1):
 * 
 *             if index2 > index1:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_9 = ((__pyx_v_index2 > __pyx_v_index1) != 0);
      if (__pyx_t_9) {

        /* "vcfutils.pyx":211
 * 
 *             if index2 > index1:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             marginalGenotypeLikelihood = 0.0
 */
        goto __pyx_L6_break;

        /* "vcfutils.pyx":210
 *         for index2 in range(nVariants + 1):
 * 
 *             if index2 > index1:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      }

      /* "vcfutils.pyx":213
 *                 break
 * 
 *             marginalGenotypeLikelihood = 0.0             # <<<<<<<<<<<<<<
 * 
 *             for genotypeIndex in range(nGenotypes):
 */
      __pyx_v_marginalGenotypeLikelihood = 0.0;

      /* "vcfutils.pyx":215
 *             marginalGenotypeLikelihood = 0.0
 * 
 *             for genotypeIndex in range(nGenotypes):             # <<<<<<<<<<<<<<
 * 
 *                 # Use pre-cached haplotype indices
 */
      __pyx_t_10 = __pyx_v_nGenotypes;
      __pyx_t_11 = __pyx_t_10;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
        __pyx_v_genotypeIndex = __pyx_t_12;

        /* "vcfutils.pyx":218
 * 
 *                 # Use pre-cached haplotype indices
 *                 hap1Index = haplotypeIndexes[genotypeIndex][0]             # <<<<<<<<<<<<<<
 *                 hap2Index = haplotypeIndexes[genotypeIndex][1]
 *                 hap1IsRefAtVarPos = haplotypeIsRefAtThisPos[hap1Index]
 */
        __pyx_v_hap1Index = ((__pyx_v_haplotypeIndexes[__pyx_v_genotypeIndex])[0]);

        /* "vcfutils.pyx":219
 *                 # Use pre-cached haplotype indices
 *                 hap1Index = haplotypeIndexes[genotypeIndex][0]
 *                 hap2Index = haplotypeIndexes[genotypeIndex][1]             # <<<<<<<<<<<<<<
 *                 hap1IsRefAtVarPos = haplotypeIsRefAtThisPos[hap1Index]
 *                 hap2IsRefAtVarPos = haplotypeIsRefAtThisPos[hap2Index]
 */
        __pyx_v_hap2Index = ((__pyx_v_haplotypeIndexes[__pyx_v_genotypeIndex])[1]);

        /* "vcfutils.pyx":220
 *                 hap1Index = haplotypeIndexes[genotypeIndex][0]
 *                 hap2Index = haplotypeIndexes[genotypeIndex][1]
 *                 hap1IsRefAtVarPos = haplotypeIsRefAtThisPos[hap1Index]             # <<<<<<<<<<<<<<
 *                 hap2IsRefAtVarPos = haplotypeIsRefAtThisPos[hap2Index]
 * 
 */
        __pyx_v_hap1IsRefAtVarPos = (__pyx_v_haplotypeIsRefAtThisPos[__pyx_v_hap1Index]);

        /* "vcfutils.pyx":221
 *                 hap2Index = haplotypeIndexes[genotypeIndex][1]
 *                 hap1IsRefAtVarPos = haplotypeIsRefAtThisPos[hap1Index]
 *                 hap2IsRefAtVarPos = haplotypeIsRefAtThisPos[hap2Index]             # <<<<<<<<<<<<<<
 * 
 *                 if hap1Index != hap2Index:
 */
        __pyx_v_hap2IsRefAtVarPos = (__pyx_v_haplotypeIsRefAtThisPos[__pyx_v_hap2Index]);

        /* "vcfutils.pyx":223
 *                 hap2IsRefAtVarPos = haplotypeIsRefAtThisPos[hap2Index]
 * 
 *                 if hap1Index != hap2Index:             # <<<<<<<<<<<<<<
 *                     factor = 2.0
 *                 else:
 */
        __pyx_t_9 = ((__pyx_v_hap1Index != __pyx_v_hap2Index) != 0);
        if (__pyx_t_9) {

          /* "vcfutils.pyx":224
 * 
 *                 if hap1Index != hap2Index:
 *                     factor = 2.0             # <<<<<<<<<<<<<<
 *                 else:
 *                     factor = 1.0
 */
          __pyx_v_factor = 2.0;

          /* "vcfutils.pyx":223
 *                 hap2IsRefAtVarPos = haplotypeIsRefAtThisPos[hap2Index]
 * 
 *                 if hap1Index != hap2Index:             # <<<<<<<<<<<<<<
 *                     factor = 2.0
 *                 else:
 */
          goto __pyx_L10;
        }

        /* "vcfutils.pyx":226
 *                     factor = 2.0
 *                 else:
 *                     factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *                 # Use EM frequencies
 */
        /*else*/ {
          __pyx_v_factor = 1.0;
        }
        __pyx_L10:;

        /* "vcfutils.pyx":229
 * 
 *                 # Use EM frequencies
 *                 haplotypeFrequency1 = haplotypeFrequencies[hap1Index]             # <<<<<<<<<<<<<<
 *                 haplotypeFrequency2 = haplotypeFrequencies[hap2Index]
 * 
 */
        __pyx_v_haplotypeFrequency1 = (__pyx_v_haplotypeFrequencies[__pyx_v_hap1Index]);

        /* "vcfutils.pyx":230
 *                 # Use EM frequencies
 *                 haplotypeFrequency1 = haplotypeFrequencies[hap1Index]
 *                 haplotypeFrequency2 = haplotypeFrequencies[hap2Index]             # <<<<<<<<<<<<<<
 * 
 *                 matchingGenotype = False
 */
        __pyx_v_haplotypeFrequency2 = (__pyx_v_haplotypeFrequencies[__pyx_v_hap2Index]);

        /* "vcfutils.pyx":232
 *                 haplotypeFrequency2 = haplotypeFrequencies[hap2Index]
 * 
 *                 matchingGenotype = False             # <<<<<<<<<<<<<<
 * 
 *                 # Ref/Ref genotype
 */
        __pyx_v_matchingGenotype = 0;

        /* "vcfutils.pyx":235
 * 
 *                 # Ref/Ref genotype
 *                 if index1 == 0 and index2 == 0:             # <<<<<<<<<<<<<<
 *                     if (hap1IsRefAtVarPos and hap2IsRefAtVarPos):
 *                         #logger.debug("hom ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 */
        __pyx_t_13 = ((__pyx_v_index1 == 0) != 0);
        if (__pyx_t_13) {
        } else {
          __pyx_t_9 = __pyx_t_13;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_13 = ((__pyx_v_index2 == 0) != 0);
        __pyx_t_9 = __pyx_t_13;
        __pyx_L12_bool_binop_done:;
        if (__pyx_t_9) {

          /* "vcfutils.pyx":236
 *                 # Ref/Ref genotype
 *                 if index1 == 0 and index2 == 0:
 *                     if (hap1IsRefAtVarPos and hap2IsRefAtVarPos):             # <<<<<<<<<<<<<<
 *                         #logger.debug("hom ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          __pyx_t_13 = (__pyx_v_hap1IsRefAtVarPos != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_9 = __pyx_t_13;
            goto __pyx_L15_bool_binop_done;
          }
          __pyx_t_13 = (__pyx_v_hap2IsRefAtVarPos != 0);
          __pyx_t_9 = __pyx_t_13;
          __pyx_L15_bool_binop_done:;
          if (__pyx_t_9) {

            /* "vcfutils.pyx":238
 *                     if (hap1IsRefAtVarPos and hap2IsRefAtVarPos):
 *                         #logger.debug("hom ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True             # <<<<<<<<<<<<<<
 * 
 *                 # Het genotype (always 1/0, 2/0 etc)
 */
            __pyx_v_matchingGenotype = 1;

            /* "vcfutils.pyx":236
 *                 # Ref/Ref genotype
 *                 if index1 == 0 and index2 == 0:
 *                     if (hap1IsRefAtVarPos and hap2IsRefAtVarPos):             # <<<<<<<<<<<<<<
 *                         #logger.debug("hom ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          }

          /* "vcfutils.pyx":235
 * 
 *                 # Ref/Ref genotype
 *                 if index1 == 0 and index2 == 0:             # <<<<<<<<<<<<<<
 *                     if (hap1IsRefAtVarPos and hap2IsRefAtVarPos):
 *                         #logger.debug("hom ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 */
          goto __pyx_L11;
        }

        /* "vcfutils.pyx":241
 * 
 *                 # Het genotype (always 1/0, 2/0 etc)
 *                 elif index2 == 0:             # <<<<<<<<<<<<<<
 * 
 *                     var1InHap1 = varInHap[hap1Index][index1-1]
 */
        __pyx_t_9 = ((__pyx_v_index2 == 0) != 0);
        if (__pyx_t_9) {

          /* "vcfutils.pyx":243
 *                 elif index2 == 0:
 * 
 *                     var1InHap1 = varInHap[hap1Index][index1-1]             # <<<<<<<<<<<<<<
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 * 
 */
          __pyx_v_var1InHap1 = ((__pyx_v_varInHap[__pyx_v_hap1Index])[(__pyx_v_index1 - 1)]);

          /* "vcfutils.pyx":244
 * 
 *                     var1InHap1 = varInHap[hap1Index][index1-1]
 *                     var1InHap2 = varInHap[hap2Index][index1-1]             # <<<<<<<<<<<<<<
 * 
 *                     if (hap2IsRefAtVarPos and var1InHap1) or (hap1IsRefAtVarPos and var1InHap2):
 */
          __pyx_v_var1InHap2 = ((__pyx_v_varInHap[__pyx_v_hap2Index])[(__pyx_v_index1 - 1)]);

          /* "vcfutils.pyx":246
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 * 
 *                     if (hap2IsRefAtVarPos and var1InHap1) or (hap1IsRefAtVarPos and var1InHap2):             # <<<<<<<<<<<<<<
 *                         #logger.debug("het ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          __pyx_t_13 = (__pyx_v_hap2IsRefAtVarPos != 0);
          if (!__pyx_t_13) {
            goto __pyx_L19_next_or;
          } else {
          }
          __pyx_t_13 = (__pyx_v_var1InHap1 != 0);
          if (!__pyx_t_13) {
          } else {
            __pyx_t_9 = __pyx_t_13;
            goto __pyx_L18_bool_binop_done;
          }
          __pyx_L19_next_or:;
          __pyx_t_13 = (__pyx_v_hap1IsRefAtVarPos != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_9 = __pyx_t_13;
            goto __pyx_L18_bool_binop_done;
          }
          __pyx_t_13 = (__pyx_v_var1InHap2 != 0);
          __pyx_t_9 = __pyx_t_13;
          __pyx_L18_bool_binop_done:;
          if (__pyx_t_9) {

            /* "vcfutils.pyx":248
 *                     if (hap2IsRefAtVarPos and var1InHap1) or (hap1IsRefAtVarPos and var1InHap2):
 *                         #logger.debug("het ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True             # <<<<<<<<<<<<<<
 * 
 *                 # Both alleles are non-ref
 */
            __pyx_v_matchingGenotype = 1;

            /* "vcfutils.pyx":246
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 * 
 *                     if (hap2IsRefAtVarPos and var1InHap1) or (hap1IsRefAtVarPos and var1InHap2):             # <<<<<<<<<<<<<<
 *                         #logger.debug("het ref genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          }

          /* "vcfutils.pyx":241
 * 
 *                 # Het genotype (always 1/0, 2/0 etc)
 *                 elif index2 == 0:             # <<<<<<<<<<<<<<
 * 
 *                     var1InHap1 = varInHap[hap1Index][index1-1]
 */
          goto __pyx_L11;
        }

        /* "vcfutils.pyx":252
 *                 # Both alleles are non-ref
 *                 else:
 *                     var1InHap1 = varInHap[hap1Index][index1-1]             # <<<<<<<<<<<<<<
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 *                     var2InHap1 = varInHap[hap1Index][index2-1]
 */
        /*else*/ {
          __pyx_v_var1InHap1 = ((__pyx_v_varInHap[__pyx_v_hap1Index])[(__pyx_v_index1 - 1)]);

          /* "vcfutils.pyx":253
 *                 else:
 *                     var1InHap1 = varInHap[hap1Index][index1-1]
 *                     var1InHap2 = varInHap[hap2Index][index1-1]             # <<<<<<<<<<<<<<
 *                     var2InHap1 = varInHap[hap1Index][index2-1]
 *                     var2InHap2 = varInHap[hap2Index][index2-1]
 */
          __pyx_v_var1InHap2 = ((__pyx_v_varInHap[__pyx_v_hap2Index])[(__pyx_v_index1 - 1)]);

          /* "vcfutils.pyx":254
 *                     var1InHap1 = varInHap[hap1Index][index1-1]
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 *                     var2InHap1 = varInHap[hap1Index][index2-1]             # <<<<<<<<<<<<<<
 *                     var2InHap2 = varInHap[hap2Index][index2-1]
 * 
 */
          __pyx_v_var2InHap1 = ((__pyx_v_varInHap[__pyx_v_hap1Index])[(__pyx_v_index2 - 1)]);

          /* "vcfutils.pyx":255
 *                     var1InHap2 = varInHap[hap2Index][index1-1]
 *                     var2InHap1 = varInHap[hap1Index][index2-1]
 *                     var2InHap2 = varInHap[hap2Index][index2-1]             # <<<<<<<<<<<<<<
 * 
 *                     if (var1InHap1 and var2InHap2) or (var2InHap1 and var1InHap2):
 */
          __pyx_v_var2InHap2 = ((__pyx_v_varInHap[__pyx_v_hap2Index])[(__pyx_v_index2 - 1)]);

          /* "vcfutils.pyx":257
 *                     var2InHap2 = varInHap[hap2Index][index2-1]
 * 
 *                     if (var1InHap1 and var2InHap2) or (var2InHap1 and var1InHap2):             # <<<<<<<<<<<<<<
 *                         #logger.debug("hom var genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          __pyx_t_13 = (__pyx_v_var1InHap1 != 0);
          if (!__pyx_t_13) {
            goto __pyx_L24_next_or;
          } else {
          }
          __pyx_t_13 = (__pyx_v_var2InHap2 != 0);
          if (!__pyx_t_13) {
          } else {
            __pyx_t_9 = __pyx_t_13;
            goto __pyx_L23_bool_binop_done;
          }
          __pyx_L24_next_or:;
          __pyx_t_13 = (__pyx_v_var2InHap1 != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_9 = __pyx_t_13;
            goto __pyx_L23_bool_binop_done;
          }
          __pyx_t_13 = (__pyx_v_var1InHap2 != 0);
          __pyx_t_9 = __pyx_t_13;
          __pyx_L23_bool_binop_done:;
          if (__pyx_t_9) {

            /* "vcfutils.pyx":259
 *                     if (var1InHap1 and var2InHap2) or (var2InHap1 and var1InHap2):
 *                         #logger.debug("hom var genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True             # <<<<<<<<<<<<<<
 * 
 *                 # Accumulate likelihoods for matching genotypes
 */
            __pyx_v_matchingGenotype = 1;

            /* "vcfutils.pyx":257
 *                     var2InHap2 = varInHap[hap2Index][index2-1]
 * 
 *                     if (var1InHap1 and var2InHap2) or (var2InHap1 and var1InHap2):             # <<<<<<<<<<<<<<
 *                         #logger.debug("hom var genotype = %s. Pos = %s." %(genotypes[genotypeIndex], variantPosition))
 *                         matchingGenotype = True
 */
          }
        }
        __pyx_L11:;

        /* "vcfutils.pyx":262
 * 
 *                 # Accumulate likelihoods for matching genotypes
 *                 if matchingGenotype:             # <<<<<<<<<<<<<<
 * 
 *                     # TODO: Fix this properly.
 */
        __pyx_t_9 = (__pyx_v_matchingGenotype != 0);
        if (__pyx_t_9) {

          /* "vcfutils.pyx":266
 *                     # TODO: Fix this properly.
 *                     # Only use EM frequencies for large-ish populations.
 *                     if nIndividuals > 25:             # <<<<<<<<<<<<<<
 *                         currentLikelihood = (factor*haplotypeFrequency1*haplotypeFrequency2*genotypeLikelihoods[sampleIndex][genotypeIndex])
 *                     else:
 */
          __pyx_t_9 = ((__pyx_v_nIndividuals > 25) != 0);
          if (__pyx_t_9) {

            /* "vcfutils.pyx":267
 *                     # Only use EM frequencies for large-ish populations.
 *                     if nIndividuals > 25:
 *                         currentLikelihood = (factor*haplotypeFrequency1*haplotypeFrequency2*genotypeLikelihoods[sampleIndex][genotypeIndex])             # <<<<<<<<<<<<<<
 *                     else:
 *                         currentLikelihood = (factor*genotypeLikelihoods[sampleIndex][genotypeIndex])
 */
            __pyx_v_currentLikelihood = (((__pyx_v_factor * __pyx_v_haplotypeFrequency1) * __pyx_v_haplotypeFrequency2) * ((__pyx_v_genotypeLikelihoods[__pyx_v_sampleIndex])[__pyx_v_genotypeIndex]));

            /* "vcfutils.pyx":266
 *                     # TODO: Fix this properly.
 *                     # Only use EM frequencies for large-ish populations.
 *                     if nIndividuals > 25:             # <<<<<<<<<<<<<<
 *                         currentLikelihood = (factor*haplotypeFrequency1*haplotypeFrequency2*genotypeLikelihoods[sampleIndex][genotypeIndex])
 *                     else:
 */
            goto __pyx_L28;
          }

          /* "vcfutils.pyx":269
 *                         currentLikelihood = (factor*haplotypeFrequency1*haplotypeFrequency2*genotypeLikelihoods[sampleIndex][genotypeIndex])
 *                     else:
 *                         currentLikelihood = (factor*genotypeLikelihoods[sampleIndex][genotypeIndex])             # <<<<<<<<<<<<<<
 * 
 *                     marginalGenotypeLikelihood += currentLikelihood
 */
          /*else*/ {
            __pyx_v_currentLikelihood = (__pyx_v_factor * ((__pyx_v_genotypeLikelihoods[__pyx_v_sampleIndex])[__pyx_v_genotypeIndex]));
          }
          __pyx_L28:;

          /* "vcfutils.pyx":271
 *                         currentLikelihood = (factor*genotypeLikelihoods[sampleIndex][genotypeIndex])
 * 
 *                     marginalGenotypeLikelihood += currentLikelihood             # <<<<<<<<<<<<<<
 * 
 *                     # Phase using maximum likelihood genotypes
 */
          __pyx_v_marginalGenotypeLikelihood = (__pyx_v_marginalGenotypeLikelihood + __pyx_v_currentLikelihood);

          /* "vcfutils.pyx":274
 * 
 *                     # Phase using maximum likelihood genotypes
 *                     if currentLikelihood > phasedMaxLike:             # <<<<<<<<<<<<<<
 *                         phasedMaxLike = currentLikelihood
 * 
 */
          __pyx_t_9 = ((__pyx_v_currentLikelihood > __pyx_v_phasedMaxLike) != 0);
          if (__pyx_t_9) {

            /* "vcfutils.pyx":275
 *                     # Phase using maximum likelihood genotypes
 *                     if currentLikelihood > phasedMaxLike:
 *                         phasedMaxLike = currentLikelihood             # <<<<<<<<<<<<<<
 * 
 *                         # Hom Ref
 */
            __pyx_v_phasedMaxLike = __pyx_v_currentLikelihood;

            /* "vcfutils.pyx":278
 * 
 *                         # Hom Ref
 *                         if index1 == 0 and index2 == 0:             # <<<<<<<<<<<<<<
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2
 */
            __pyx_t_13 = ((__pyx_v_index1 == 0) != 0);
            if (__pyx_t_13) {
            } else {
              __pyx_t_9 = __pyx_t_13;
              goto __pyx_L31_bool_binop_done;
            }
            __pyx_t_13 = ((__pyx_v_index2 == 0) != 0);
            __pyx_t_9 = __pyx_t_13;
            __pyx_L31_bool_binop_done:;
            if (__pyx_t_9) {

              /* "vcfutils.pyx":279
 *                         # Hom Ref
 *                         if index1 == 0 and index2 == 0:
 *                             phasedIndex1 = index1             # <<<<<<<<<<<<<<
 *                             phasedIndex2 = index2
 * 
 */
              __pyx_v_phasedIndex1 = __pyx_v_index1;

              /* "vcfutils.pyx":280
 *                         if index1 == 0 and index2 == 0:
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2             # <<<<<<<<<<<<<<
 * 
 *                         # Het. Make sure genotype call is phased correctly.
 */
              __pyx_v_phasedIndex2 = __pyx_v_index2;

              /* "vcfutils.pyx":278
 * 
 *                         # Hom Ref
 *                         if index1 == 0 and index2 == 0:             # <<<<<<<<<<<<<<
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2
 */
              goto __pyx_L30;
            }

            /* "vcfutils.pyx":283
 * 
 *                         # Het. Make sure genotype call is phased correctly.
 *                         elif index2 == 0 and index1 != 0:             # <<<<<<<<<<<<<<
 * 
 *                             if var1InHap1:
 */
            __pyx_t_13 = ((__pyx_v_index2 == 0) != 0);
            if (__pyx_t_13) {
            } else {
              __pyx_t_9 = __pyx_t_13;
              goto __pyx_L33_bool_binop_done;
            }
            __pyx_t_13 = ((__pyx_v_index1 != 0) != 0);
            __pyx_t_9 = __pyx_t_13;
            __pyx_L33_bool_binop_done:;
            if (__pyx_t_9) {

              /* "vcfutils.pyx":285
 *                         elif index2 == 0 and index1 != 0:
 * 
 *                             if var1InHap1:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 */
              __pyx_t_9 = (__pyx_v_var1InHap1 != 0);
              if (__pyx_t_9) {

                /* "vcfutils.pyx":286
 * 
 *                             if var1InHap1:
 *                                 phasedIndex1 = index1             # <<<<<<<<<<<<<<
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2:
 */
                __pyx_v_phasedIndex1 = __pyx_v_index1;

                /* "vcfutils.pyx":287
 *                             if var1InHap1:
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2             # <<<<<<<<<<<<<<
 *                             elif var1InHap2:
 *                                 phasedIndex1 = index2
 */
                __pyx_v_phasedIndex2 = __pyx_v_index2;

                /* "vcfutils.pyx":285
 *                         elif index2 == 0 and index1 != 0:
 * 
 *                             if var1InHap1:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 */
                goto __pyx_L35;
              }

              /* "vcfutils.pyx":288
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1
 */
              __pyx_t_9 = (__pyx_v_var1InHap2 != 0);
              if (__pyx_t_9) {

                /* "vcfutils.pyx":289
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2:
 *                                 phasedIndex1 = index2             # <<<<<<<<<<<<<<
 *                                 phasedIndex2 = index1
 *                             # This will happen on the way
 */
                __pyx_v_phasedIndex1 = __pyx_v_index2;

                /* "vcfutils.pyx":290
 *                             elif var1InHap2:
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1             # <<<<<<<<<<<<<<
 *                             # This will happen on the way
 *                             else:
 */
                __pyx_v_phasedIndex2 = __pyx_v_index1;

                /* "vcfutils.pyx":288
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1
 */
                goto __pyx_L35;
              }

              /* "vcfutils.pyx":293
 *                             # This will happen on the way
 *                             else:
 *                                 pass             # <<<<<<<<<<<<<<
 * 
 *                         # Hom Var. Don't need to phase
 */
              /*else*/ {
              }
              __pyx_L35:;

              /* "vcfutils.pyx":283
 * 
 *                         # Het. Make sure genotype call is phased correctly.
 *                         elif index2 == 0 and index1 != 0:             # <<<<<<<<<<<<<<
 * 
 *                             if var1InHap1:
 */
              goto __pyx_L30;
            }

            /* "vcfutils.pyx":296
 * 
 *                         # Hom Var. Don't need to phase
 *                         elif index2 == index1 and index1 > 0:             # <<<<<<<<<<<<<<
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2
 */
            __pyx_t_13 = ((__pyx_v_index2 == __pyx_v_index1) != 0);
            if (__pyx_t_13) {
            } else {
              __pyx_t_9 = __pyx_t_13;
              goto __pyx_L36_bool_binop_done;
            }
            __pyx_t_13 = ((__pyx_v_index1 > 0) != 0);
            __pyx_t_9 = __pyx_t_13;
            __pyx_L36_bool_binop_done:;
            if (__pyx_t_9) {

              /* "vcfutils.pyx":297
 *                         # Hom Var. Don't need to phase
 *                         elif index2 == index1 and index1 > 0:
 *                             phasedIndex1 = index1             # <<<<<<<<<<<<<<
 *                             phasedIndex2 = index2
 * 
 */
              __pyx_v_phasedIndex1 = __pyx_v_index1;

              /* "vcfutils.pyx":298
 *                         elif index2 == index1 and index1 > 0:
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2             # <<<<<<<<<<<<<<
 * 
 *                         # Multi-allelic het. Make sure call is phased correctly.
 */
              __pyx_v_phasedIndex2 = __pyx_v_index2;

              /* "vcfutils.pyx":296
 * 
 *                         # Hom Var. Don't need to phase
 *                         elif index2 == index1 and index1 > 0:             # <<<<<<<<<<<<<<
 *                             phasedIndex1 = index1
 *                             phasedIndex2 = index2
 */
              goto __pyx_L30;
            }

            /* "vcfutils.pyx":301
 * 
 *                         # Multi-allelic het. Make sure call is phased correctly.
 *                         elif index2 > 0 and index1 > 0 and index2 != index1:             # <<<<<<<<<<<<<<
 * 
 *                             if var1InHap1 and var2InHap2:
 */
            __pyx_t_13 = ((__pyx_v_index2 > 0) != 0);
            if (__pyx_t_13) {
            } else {
              __pyx_t_9 = __pyx_t_13;
              goto __pyx_L38_bool_binop_done;
            }
            __pyx_t_13 = ((__pyx_v_index1 > 0) != 0);
            if (__pyx_t_13) {
            } else {
              __pyx_t_9 = __pyx_t_13;
              goto __pyx_L38_bool_binop_done;
            }
            __pyx_t_13 = ((__pyx_v_index2 != __pyx_v_index1) != 0);
            __pyx_t_9 = __pyx_t_13;
            __pyx_L38_bool_binop_done:;
            if (__pyx_t_9) {

              /* "vcfutils.pyx":303
 *                         elif index2 > 0 and index1 > 0 and index2 != index1:
 * 
 *                             if var1InHap1 and var2InHap2:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 */
              __pyx_t_13 = (__pyx_v_var1InHap1 != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_9 = __pyx_t_13;
                goto __pyx_L42_bool_binop_done;
              }
              __pyx_t_13 = (__pyx_v_var2InHap2 != 0);
              __pyx_t_9 = __pyx_t_13;
              __pyx_L42_bool_binop_done:;
              if (__pyx_t_9) {

                /* "vcfutils.pyx":304
 * 
 *                             if var1InHap1 and var2InHap2:
 *                                 phasedIndex1 = index1             # <<<<<<<<<<<<<<
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2 and var2InHap1:
 */
                __pyx_v_phasedIndex1 = __pyx_v_index1;

                /* "vcfutils.pyx":305
 *                             if var1InHap1 and var2InHap2:
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2             # <<<<<<<<<<<<<<
 *                             elif var1InHap2 and var2InHap1:
 *                                 phasedIndex1 = index2
 */
                __pyx_v_phasedIndex2 = __pyx_v_index2;

                /* "vcfutils.pyx":303
 *                         elif index2 > 0 and index1 > 0 and index2 != index1:
 * 
 *                             if var1InHap1 and var2InHap2:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 */
                goto __pyx_L41;
              }

              /* "vcfutils.pyx":306
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2 and var2InHap1:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1
 */
              __pyx_t_13 = (__pyx_v_var1InHap2 != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_9 = __pyx_t_13;
                goto __pyx_L44_bool_binop_done;
              }
              __pyx_t_13 = (__pyx_v_var2InHap1 != 0);
              __pyx_t_9 = __pyx_t_13;
              __pyx_L44_bool_binop_done:;
              if (__pyx_t_9) {

                /* "vcfutils.pyx":307
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2 and var2InHap1:
 *                                 phasedIndex1 = index2             # <<<<<<<<<<<<<<
 *                                 phasedIndex2 = index1
 *                             # This will happen on the way
 */
                __pyx_v_phasedIndex1 = __pyx_v_index2;

                /* "vcfutils.pyx":308
 *                             elif var1InHap2 and var2InHap1:
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1             # <<<<<<<<<<<<<<
 *                             # This will happen on the way
 *                             else:
 */
                __pyx_v_phasedIndex2 = __pyx_v_index1;

                /* "vcfutils.pyx":306
 *                                 phasedIndex1 = index1
 *                                 phasedIndex2 = index2
 *                             elif var1InHap2 and var2InHap1:             # <<<<<<<<<<<<<<
 *                                 phasedIndex1 = index2
 *                                 phasedIndex2 = index1
 */
                goto __pyx_L41;
              }

              /* "vcfutils.pyx":311
 *                             # This will happen on the way
 *                             else:
 *                                 pass             # <<<<<<<<<<<<<<
 * 
 *                     if gofValues[genotypeIndex][sampleIndex] < bestGoodnessOfFitValue:
 */
              /*else*/ {
              }
              __pyx_L41:;

              /* "vcfutils.pyx":301
 * 
 *                         # Multi-allelic het. Make sure call is phased correctly.
 *                         elif index2 > 0 and index1 > 0 and index2 != index1:             # <<<<<<<<<<<<<<
 * 
 *                             if var1InHap1 and var2InHap2:
 */
            }
            __pyx_L30:;

            /* "vcfutils.pyx":274
 * 
 *                     # Phase using maximum likelihood genotypes
 *                     if currentLikelihood > phasedMaxLike:             # <<<<<<<<<<<<<<
 *                         phasedMaxLike = currentLikelihood
 * 
 */
          }

          /* "vcfutils.pyx":313
 *                                 pass
 * 
 *                     if gofValues[genotypeIndex][sampleIndex] < bestGoodnessOfFitValue:             # <<<<<<<<<<<<<<
 *                         bestGoodnessOfFitValue = gofValues[genotypeIndex][sampleIndex]
 * 
 */
          __pyx_t_9 = ((((__pyx_v_gofValues[__pyx_v_genotypeIndex])[__pyx_v_sampleIndex]) < __pyx_v_bestGoodnessOfFitValue) != 0);
          if (__pyx_t_9) {

            /* "vcfutils.pyx":314
 * 
 *                     if gofValues[genotypeIndex][sampleIndex] < bestGoodnessOfFitValue:
 *                         bestGoodnessOfFitValue = gofValues[genotypeIndex][sampleIndex]             # <<<<<<<<<<<<<<
 * 
 *             # Pick the best variant pair for this site
 */
            __pyx_v_bestGoodnessOfFitValue = ((__pyx_v_gofValues[__pyx_v_genotypeIndex])[__pyx_v_sampleIndex]);

            /* "vcfutils.pyx":313
 *                                 pass
 * 
 *                     if gofValues[genotypeIndex][sampleIndex] < bestGoodnessOfFitValue:             # <<<<<<<<<<<<<<
 *                         bestGoodnessOfFitValue = gofValues[genotypeIndex][sampleIndex]
 * 
 */
          }

          /* "vcfutils.pyx":262
 * 
 *                 # Accumulate likelihoods for matching genotypes
 *                 if matchingGenotype:             # <<<<<<<<<<<<<<
 * 
 *                     # TODO: Fix this properly.
 */
        }
      }

      /* "vcfutils.pyx":317
 * 
 *             # Pick the best variant pair for this site
 *             if marginalGenotypeLikelihood > bestLikelihood:             # <<<<<<<<<<<<<<
 * 
 *                 bestLikelihood = marginalGenotypeLikelihood
 */
      __pyx_t_9 = ((__pyx_v_marginalGenotypeLikelihood > __pyx_v_bestLikelihood) != 0);
      if (__pyx_t_9) {

        /* "vcfutils.pyx":319
 *             if marginalGenotypeLikelihood > bestLikelihood:
 * 
 *                 bestLikelihood = marginalGenotypeLikelihood             # <<<<<<<<<<<<<<
 *                 bestVarIndex1 = index1
 *                 bestVarIndex2 = index2
 */
        __pyx_v_bestLikelihood = __pyx_v_marginalGenotypeLikelihood;

        /* "vcfutils.pyx":320
 * 
 *                 bestLikelihood = marginalGenotypeLikelihood
 *                 bestVarIndex1 = index1             # <<<<<<<<<<<<<<
 *                 bestVarIndex2 = index2
 * 
 */
        __pyx_v_bestVarIndex1 = __pyx_v_index1;

        /* "vcfutils.pyx":321
 *                 bestLikelihood = marginalGenotypeLikelihood
 *                 bestVarIndex1 = index1
 *                 bestVarIndex2 = index2             # <<<<<<<<<<<<<<
 * 
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):
 */
        __pyx_v_bestVarIndex2 = __pyx_v_index2;

        /* "vcfutils.pyx":317
 * 
 *             # Pick the best variant pair for this site
 *             if marginalGenotypeLikelihood > bestLikelihood:             # <<<<<<<<<<<<<<
 * 
 *                 bestLikelihood = marginalGenotypeLikelihood
 */
      }

      /* "vcfutils.pyx":323
 *                 bestVarIndex2 = index2
 * 
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):             # <<<<<<<<<<<<<<
 *                 nonRefPosterior += marginalGenotypeLikelihood
 *             elif (index1 == 0 and index2 == 0):
 */
      __pyx_t_13 = ((__pyx_v_index1 == 1) != 0);
      if (!__pyx_t_13) {
        goto __pyx_L50_next_or;
      } else {
      }
      __pyx_t_13 = ((__pyx_v_index2 == 0) != 0);
      if (!__pyx_t_13) {
      } else {
        __pyx_t_9 = __pyx_t_13;
        goto __pyx_L49_bool_binop_done;
      }
      __pyx_L50_next_or:;
      __pyx_t_13 = ((__pyx_v_index1 == 1) != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_9 = __pyx_t_13;
        goto __pyx_L49_bool_binop_done;
      }
      __pyx_t_13 = ((__pyx_v_index2 == 1) != 0);
      __pyx_t_9 = __pyx_t_13;
      __pyx_L49_bool_binop_done:;
      if (__pyx_t_9) {

        /* "vcfutils.pyx":324
 * 
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):
 *                 nonRefPosterior += marginalGenotypeLikelihood             # <<<<<<<<<<<<<<
 *             elif (index1 == 0 and index2 == 0):
 *                 refPosterior += marginalGenotypeLikelihood
 */
        __pyx_v_nonRefPosterior = (__pyx_v_nonRefPosterior + __pyx_v_marginalGenotypeLikelihood);

        /* "vcfutils.pyx":323
 *                 bestVarIndex2 = index2
 * 
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):             # <<<<<<<<<<<<<<
 *                 nonRefPosterior += marginalGenotypeLikelihood
 *             elif (index1 == 0 and index2 == 0):
 */
        goto __pyx_L48;
      }

      /* "vcfutils.pyx":325
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):
 *                 nonRefPosterior += marginalGenotypeLikelihood
 *             elif (index1 == 0 and index2 == 0):             # <<<<<<<<<<<<<<
 *                 refPosterior += marginalGenotypeLikelihood
 * 
 */
      __pyx_t_13 = ((__pyx_v_index1 == 0) != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_9 = __pyx_t_13;
        goto __pyx_L53_bool_binop_done;
      }
      __pyx_t_13 = ((__pyx_v_index2 == 0) != 0);
      __pyx_t_9 = __pyx_t_13;
      __pyx_L53_bool_binop_done:;
      if (__pyx_t_9) {

        /* "vcfutils.pyx":326
 *                 nonRefPosterior += marginalGenotypeLikelihood
 *             elif (index1 == 0 and index2 == 0):
 *                 refPosterior += marginalGenotypeLikelihood             # <<<<<<<<<<<<<<
 * 
 *             sumLikelihoods += marginalGenotypeLikelihood
 */
        __pyx_v_refPosterior = (__pyx_v_refPosterior + __pyx_v_marginalGenotypeLikelihood);

        /* "vcfutils.pyx":325
 *             if (index1 == 1 and index2 == 0) or (index1 == 1 and index2 == 1):
 *                 nonRefPosterior += marginalGenotypeLikelihood
 *             elif (index1 == 0 and index2 == 0):             # <<<<<<<<<<<<<<
 *                 refPosterior += marginalGenotypeLikelihood
 * 
 */
      }
      __pyx_L48:;

      /* "vcfutils.pyx":328
 *                 refPosterior += marginalGenotypeLikelihood
 * 
 *             sumLikelihoods += marginalGenotypeLikelihood             # <<<<<<<<<<<<<<
 *             likelihoods.append(marginalGenotypeLikelihood)
 * 
 */
      __pyx_v_sumLikelihoods = (__pyx_v_sumLikelihoods + __pyx_v_marginalGenotypeLikelihood);

      /* "vcfutils.pyx":329
 * 
 *             sumLikelihoods += marginalGenotypeLikelihood
 *             likelihoods.append(marginalGenotypeLikelihood)             # <<<<<<<<<<<<<<
 * 
 *     #for genotypeIndex in range(nGenotypes):
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_marginalGenotypeLikelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_likelihoods, __pyx_t_1); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 329, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6_break:;
  }

  /* "vcfutils.pyx":334
 *     #    logger.debug("GL for sample %s, index %s = %s" %(sampleIndex, genotypeIndex, genotypeLikelihoods[sampleIndex][genotypeIndex]))
 * 
 *     return (phasedIndex1,phasedIndex2,likelihoods,bestLikelihood/sumLikelihoods,nonRefPosterior/sumLikelihoods,refPosterior/sumLikelihoods,bestGoodnessOfFitValue)             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_phasedIndex1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_phasedIndex2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyFloat_FromDouble((__pyx_v_bestLikelihood / __pyx_v_sumLikelihoods)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_17 = PyFloat_FromDouble((__pyx_v_nonRefPosterior / __pyx_v_sumLikelihoods)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_18 = PyFloat_FromDouble((__pyx_v_refPosterior / __pyx_v_sumLikelihoods)); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_bestGoodnessOfFitValue); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_20 = PyTuple_New(7); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_15);
  __Pyx_INCREF(__pyx_v_likelihoods);
  __Pyx_GIVEREF(__pyx_v_likelihoods);
  PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_v_likelihoods);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_17);
  PyTuple_SET_ITEM(__pyx_t_20, 4, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_18);
  PyTuple_SET_ITEM(__pyx_t_20, 5, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_20, 6, __pyx_t_19);
  __pyx_t_1 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;
  __pyx_t_18 = 0;
  __pyx_t_19 = 0;
  __pyx_r = ((PyObject*)__pyx_t_20);
  __pyx_t_20 = 0;
  goto __pyx_L0;

  /* "vcfutils.pyx":163
 * ###################################################################################################
 * 
 * cdef tuple computeGenotypeCallAndLikelihoods(int variantPosition, list haplotypes, list genotypes, int sampleIndex, double* haplotypeFrequencies, double** genotypeLikelihoods, double** gofValues, int** haplotypeIndexes, int** varInHap, list variantsThisPos, int* haplotypeIsRefAtThisPos, int nIndividuals, thisSample):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_AddTraceback("vcfutils.computeGenotypeCallAndLikelihoods", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_genotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_variant);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap2);
  __Pyx_XDECREF(__pyx_v_likelihoods);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":338
 * ###################################################################################################
 * 
 * cdef void outputCallToVCF(dict varsByPos, dict vcfInfo, dict vcfFilter, list haplotypes, list genotypes, double* haplotypeFrequencies, double** genotypeLikelihoods, double** gofValues, int** haplotypeIndexes, list readBuffers, int nIndividuals, vcfFile, FastaFile refFile, outputFile, options, list allVariants, int windowStart, int windowEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Output a call to a vcf file. Uses the signature of the callingModule.
 */

static void __pyx_f_8vcfutils_outputCallToVCF(PyObject *__pyx_v_varsByPos, PyObject *__pyx_v_vcfInfo, PyObject *__pyx_v_vcfFilter, PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_genotypes, double *__pyx_v_haplotypeFrequencies, double **__pyx_v_genotypeLikelihoods, double **__pyx_v_gofValues, int **__pyx_v_haplotypeIndexes, PyObject *__pyx_v_readBuffers, int __pyx_v_nIndividuals, PyObject *__pyx_v_vcfFile, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_options, PyObject *__pyx_v_allVariants, int __pyx_v_windowStart, int __pyx_v_windowEnd) {
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_haplotype = 0;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theBuffer = 0;
  PyObject *__pyx_v_info = 0;
  PyObject *__pyx_v_lineinfo = 0;
  PyObject *__pyx_v_normalisedGLs = 0;
  PyObject *__pyx_v_FR = 0;
  PyObject *__pyx_v_PP = 0;
  PyObject *__pyx_v_NF = 0;
  PyObject *__pyx_v_NR = 0;
  PyObject *__pyx_v_TR = 0;
  PyObject *__pyx_v_GT = 0;
  PyObject *__pyx_v_linefilter = 0;
  CYTHON_UNUSED int __pyx_v_gofThreshold;
  int __pyx_v_i;
  CYTHON_UNUSED int __pyx_v_variantIndex;
  int __pyx_v_nVariants;
  CYTHON_UNUSED int __pyx_v_nVarsHap1;
  CYTHON_UNUSED int __pyx_v_nVarsHap2;
  CYTHON_UNUSED int __pyx_v_tnReadsThisIndividual;
  int __pyx_v_index1;
  int __pyx_v_index2;
  int __pyx_v_hapIndex;
  CYTHON_UNUSED double __pyx_v_mLTOT;
  double __pyx_v_genotypePosterior;
  double __pyx_v_nonRefPosterior;
  double __pyx_v_refPosterior;
  double __pyx_v_maxLikelihood;
  double __pyx_v_gofValue;
  double __pyx_v_maxGofValue;
  double __pyx_v_minGofValue;
  PyObject *__pyx_v_thisSample = 0;
  PyObject *__pyx_v_sortedPositions = 0;
  PyObject *__pyx_v_variants = 0;
  PyObject *__pyx_v_likelihoods = 0;
  PyObject *__pyx_v_variantsThisPos = 0;
  int **__pyx_v_varThisPosInHap;
  int *__pyx_v_haplotypeIsRefAtThisPos;
  CYTHON_UNUSED int __pyx_v_hapIsRef;
  PyObject *__pyx_v_POS = NULL;
  PyObject *__pyx_v_variant = NULL;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_alt = NULL;
  PyObject *__pyx_v_theId = NULL;
  PyObject *__pyx_v_qual = NULL;
  PyObject *__pyx_v_format = NULL;
  PyObject *__pyx_v_var = NULL;
  PyObject *__pyx_v_freq = NULL;
  PyObject *__pyx_v_posterior = NULL;
  PyObject *__pyx_v_varTR = NULL;
  PyObject *__pyx_v_varNF = NULL;
  PyObject *__pyx_v_varNR = NULL;
  PyObject *__pyx_v_vcfDataLine = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_theVar = NULL;
  PyObject *__pyx_v_gofsThisPos = NULL;
  PyObject *__pyx_v_nNonRefCalls = NULL;
  PyObject *__pyx_v_phredPosterior = NULL;
  PyObject *__pyx_v_phredNonRefPosterior = NULL;
  PyObject *__pyx_v_phredRefPosterior = NULL;
  PyObject *__pyx_v_readsPerSample = NULL;
  PyObject *__pyx_v_varReadsPerSample = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_theChrom = NULL;
  PyObject *__pyx_v_thePos = NULL;
  PyObject *__pyx_v_theRef = NULL;
  PyObject *__pyx_v_theAlt = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_v_pp = NULL;
  PyObject *__pyx_v_x = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  char *__pyx_t_17;
  PyObject *(*__pyx_t_18)(PyObject *);
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_t_21;
  double __pyx_t_22;
  double __pyx_t_23;
  double __pyx_t_24;
  double __pyx_t_25;
  long __pyx_t_26;
  __Pyx_RefNannySetupContext("outputCallToVCF", 0);

  /* "vcfutils.pyx":353
 *     cdef cAlignedRead** endRead
 * 
 *     cdef dict info = vcfInfo             # <<<<<<<<<<<<<<
 *     cdef dict lineinfo
 * 
 */
  __Pyx_INCREF(__pyx_v_vcfInfo);
  __pyx_v_info = __pyx_v_vcfInfo;

  /* "vcfutils.pyx":367
 *     cdef list linefilter
 * 
 *     cdef int gofThreshold = options.maxGOF             # <<<<<<<<<<<<<<
 *     cdef int i = 0
 *     cdef int variantIndex = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_maxGOF); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_gofThreshold = __pyx_t_2;

  /* "vcfutils.pyx":368
 * 
 *     cdef int gofThreshold = options.maxGOF
 *     cdef int i = 0             # <<<<<<<<<<<<<<
 *     cdef int variantIndex = 0
 *     cdef int nVariants = 0
 */
  __pyx_v_i = 0;

  /* "vcfutils.pyx":369
 *     cdef int gofThreshold = options.maxGOF
 *     cdef int i = 0
 *     cdef int variantIndex = 0             # <<<<<<<<<<<<<<
 *     cdef int nVariants = 0
 *     cdef int nVarsHap1 = 0
 */
  __pyx_v_variantIndex = 0;

  /* "vcfutils.pyx":370
 *     cdef int i = 0
 *     cdef int variantIndex = 0
 *     cdef int nVariants = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsHap1 = 0
 *     cdef int nVarsHap2 = 0
 */
  __pyx_v_nVariants = 0;

  /* "vcfutils.pyx":371
 *     cdef int variantIndex = 0
 *     cdef int nVariants = 0
 *     cdef int nVarsHap1 = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsHap2 = 0
 *     cdef int tnReadsThisIndividual = 0
 */
  __pyx_v_nVarsHap1 = 0;

  /* "vcfutils.pyx":372
 *     cdef int nVariants = 0
 *     cdef int nVarsHap1 = 0
 *     cdef int nVarsHap2 = 0             # <<<<<<<<<<<<<<
 *     cdef int tnReadsThisIndividual = 0
 *     cdef int index1,index2,hapIndex = 0
 */
  __pyx_v_nVarsHap2 = 0;

  /* "vcfutils.pyx":373
 *     cdef int nVarsHap1 = 0
 *     cdef int nVarsHap2 = 0
 *     cdef int tnReadsThisIndividual = 0             # <<<<<<<<<<<<<<
 *     cdef int index1,index2,hapIndex = 0
 * 
 */
  __pyx_v_tnReadsThisIndividual = 0;

  /* "vcfutils.pyx":374
 *     cdef int nVarsHap2 = 0
 *     cdef int tnReadsThisIndividual = 0
 *     cdef int index1,index2,hapIndex = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten
 */
  __pyx_v_hapIndex = 0;

  /* "vcfutils.pyx":376
 *     cdef int index1,index2,hapIndex = 0
 * 
 *     cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten             # <<<<<<<<<<<<<<
 *     cdef double genotypePosterior = 0.0
 *     cdef double nonRefPosterior = 0.0
 */
  __pyx_v_mLTOT = -0.23025850929940459;

  /* "vcfutils.pyx":377
 * 
 *     cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten
 *     cdef double genotypePosterior = 0.0             # <<<<<<<<<<<<<<
 *     cdef double nonRefPosterior = 0.0
 *     cdef double refPosterior = 0.0
 */
  __pyx_v_genotypePosterior = 0.0;

  /* "vcfutils.pyx":378
 *     cdef double mLTOT = -0.23025850929940459 # Minus log ten over ten
 *     cdef double genotypePosterior = 0.0
 *     cdef double nonRefPosterior = 0.0             # <<<<<<<<<<<<<<
 *     cdef double refPosterior = 0.0
 *     cdef double maxLikelihood = 0.0
 */
  __pyx_v_nonRefPosterior = 0.0;

  /* "vcfutils.pyx":379
 *     cdef double genotypePosterior = 0.0
 *     cdef double nonRefPosterior = 0.0
 *     cdef double refPosterior = 0.0             # <<<<<<<<<<<<<<
 *     cdef double maxLikelihood = 0.0
 *     cdef double gofValue = 0.0
 */
  __pyx_v_refPosterior = 0.0;

  /* "vcfutils.pyx":380
 *     cdef double nonRefPosterior = 0.0
 *     cdef double refPosterior = 0.0
 *     cdef double maxLikelihood = 0.0             # <<<<<<<<<<<<<<
 *     cdef double gofValue = 0.0
 *     cdef double maxGofValue = 0.0
 */
  __pyx_v_maxLikelihood = 0.0;

  /* "vcfutils.pyx":381
 *     cdef double refPosterior = 0.0
 *     cdef double maxLikelihood = 0.0
 *     cdef double gofValue = 0.0             # <<<<<<<<<<<<<<
 *     cdef double maxGofValue = 0.0
 *     cdef double minGofValue = 1e6
 */
  __pyx_v_gofValue = 0.0;

  /* "vcfutils.pyx":382
 *     cdef double maxLikelihood = 0.0
 *     cdef double gofValue = 0.0
 *     cdef double maxGofValue = 0.0             # <<<<<<<<<<<<<<
 *     cdef double minGofValue = 1e6
 * 
 */
  __pyx_v_maxGofValue = 0.0;

  /* "vcfutils.pyx":383
 *     cdef double gofValue = 0.0
 *     cdef double maxGofValue = 0.0
 *     cdef double minGofValue = 1e6             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes thisSample
 */
  __pyx_v_minGofValue = 1e6;

  /* "vcfutils.pyx":386
 * 
 *     cdef bytes thisSample
 *     cdef list sortedPositions = sorted(varsByPos.keys())             # <<<<<<<<<<<<<<
 *     cdef list variants
 *     cdef list likelihoods = None
 */
  if (unlikely(__pyx_v_varsByPos == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 386, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_varsByPos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_5 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 386, __pyx_L1_error)
  __pyx_v_sortedPositions = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":388
 *     cdef list sortedPositions = sorted(varsByPos.keys())
 *     cdef list variants
 *     cdef list likelihoods = None             # <<<<<<<<<<<<<<
 *     cdef list variantsThisPos
 * 
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_likelihoods = ((PyObject*)Py_None);

  /* "vcfutils.pyx":391
 *     cdef list variantsThisPos
 * 
 *     cdef int** varThisPosInHap = <int**>(calloc(len(haplotypes), sizeof(int*)))             # <<<<<<<<<<<<<<
 *     cdef int* haplotypeIsRefAtThisPos = <int*>(calloc(len(haplotypes), sizeof(int)))
 *     cdef int hapIsRef = 0
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 391, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 391, __pyx_L1_error)
  __pyx_v_varThisPosInHap = ((int **)calloc(__pyx_t_6, (sizeof(int *))));

  /* "vcfutils.pyx":392
 * 
 *     cdef int** varThisPosInHap = <int**>(calloc(len(haplotypes), sizeof(int*)))
 *     cdef int* haplotypeIsRefAtThisPos = <int*>(calloc(len(haplotypes), sizeof(int)))             # <<<<<<<<<<<<<<
 *     cdef int hapIsRef = 0
 * 
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 392, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 392, __pyx_L1_error)
  __pyx_v_haplotypeIsRefAtThisPos = ((int *)calloc(__pyx_t_6, (sizeof(int))));

  /* "vcfutils.pyx":393
 *     cdef int** varThisPosInHap = <int**>(calloc(len(haplotypes), sizeof(int*)))
 *     cdef int* haplotypeIsRefAtThisPos = <int*>(calloc(len(haplotypes), sizeof(int)))
 *     cdef int hapIsRef = 0             # <<<<<<<<<<<<<<
 * 
 *     for hapIndex in range(len(haplotypes)):
 */
  __pyx_v_hapIsRef = 0;

  /* "vcfutils.pyx":395
 *     cdef int hapIsRef = 0
 * 
 *     for hapIndex in range(len(haplotypes)):             # <<<<<<<<<<<<<<
 *         varThisPosInHap[hapIndex] = <int*>(calloc(len(allVariants), sizeof(int)))
 * 
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 395, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 395, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_7; __pyx_t_2+=1) {
    __pyx_v_hapIndex = __pyx_t_2;

    /* "vcfutils.pyx":396
 * 
 *     for hapIndex in range(len(haplotypes)):
 *         varThisPosInHap[hapIndex] = <int*>(calloc(len(allVariants), sizeof(int)))             # <<<<<<<<<<<<<<
 * 
 *     for POS in sortedPositions:
 */
    if (unlikely(__pyx_v_allVariants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 396, __pyx_L1_error)
    }
    __pyx_t_8 = PyList_GET_SIZE(__pyx_v_allVariants); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 396, __pyx_L1_error)
    (__pyx_v_varThisPosInHap[__pyx_v_hapIndex]) = ((int *)calloc(__pyx_t_8, (sizeof(int))));
  }

  /* "vcfutils.pyx":398
 *         varThisPosInHap[hapIndex] = <int*>(calloc(len(allVariants), sizeof(int)))
 * 
 *     for POS in sortedPositions:             # <<<<<<<<<<<<<<
 * 
 *         #logger.info("Variants at position %s = %s" %(POS, varsByPos[POS]))
 */
  if (unlikely(__pyx_v_sortedPositions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 398, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_sortedPositions; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 398, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_POS, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":402
 *         #logger.info("Variants at position %s = %s" %(POS, varsByPos[POS]))
 * 
 *         maxGofValue = 0.0             # <<<<<<<<<<<<<<
 *         minGofValue = 1e6
 *         variants = varsByPos[POS]
 */
    __pyx_v_maxGofValue = 0.0;

    /* "vcfutils.pyx":403
 * 
 *         maxGofValue = 0.0
 *         minGofValue = 1e6             # <<<<<<<<<<<<<<
 *         variants = varsByPos[POS]
 *         variantsThisPos = variants
 */
    __pyx_v_minGofValue = 1e6;

    /* "vcfutils.pyx":404
 *         maxGofValue = 0.0
 *         minGofValue = 1e6
 *         variants = varsByPos[POS]             # <<<<<<<<<<<<<<
 *         variantsThisPos = variants
 *         nVariants = len(variants)
 */
    if (unlikely(__pyx_v_varsByPos == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 404, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_varsByPos, __pyx_v_POS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 404, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_variants, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":405
 *         minGofValue = 1e6
 *         variants = varsByPos[POS]
 *         variantsThisPos = variants             # <<<<<<<<<<<<<<
 *         nVariants = len(variants)
 * 
 */
    __Pyx_INCREF(__pyx_v_variants);
    __Pyx_XDECREF_SET(__pyx_v_variantsThisPos, __pyx_v_variants);

    /* "vcfutils.pyx":406
 *         variants = varsByPos[POS]
 *         variantsThisPos = variants
 *         nVariants = len(variants)             # <<<<<<<<<<<<<<
 * 
 *         # Store boolean flag saying if each haplotype is reference at this position, for use in genotype/likelihood computation
 */
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 406, __pyx_L1_error)
    }
    __pyx_t_7 = PyList_GET_SIZE(__pyx_v_variants); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 406, __pyx_L1_error)
    __pyx_v_nVariants = __pyx_t_7;

    /* "vcfutils.pyx":409
 * 
 *         # Store boolean flag saying if each haplotype is reference at this position, for use in genotype/likelihood computation
 *         for hapIndex,haplotype in enumerate(haplotypes):             # <<<<<<<<<<<<<<
 * 
 *             haplotypeIsRefAtThisPos[hapIndex] = 1
 */
    __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_v_haplotypes; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
    for (;;) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 409, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 409, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_haplotype, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_v_hapIndex = __pyx_t_2;
      __pyx_t_2 = (__pyx_t_2 + 1);

      /* "vcfutils.pyx":411
 *         for hapIndex,haplotype in enumerate(haplotypes):
 * 
 *             haplotypeIsRefAtThisPos[hapIndex] = 1             # <<<<<<<<<<<<<<
 * 
 *             for variantIndex,variant in enumerate(variants):
 */
      (__pyx_v_haplotypeIsRefAtThisPos[__pyx_v_hapIndex]) = 1;

      /* "vcfutils.pyx":413
 *             haplotypeIsRefAtThisPos[hapIndex] = 1
 * 
 *             for variantIndex,variant in enumerate(variants):             # <<<<<<<<<<<<<<
 * 
 *                 if variant in haplotype.variants:
 */
      __pyx_t_9 = 0;
      __pyx_t_3 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 413, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 413, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_variant, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_v_variantIndex = __pyx_t_9;
        __pyx_t_9 = (__pyx_t_9 + 1);

        /* "vcfutils.pyx":415
 *             for variantIndex,variant in enumerate(variants):
 * 
 *                 if variant in haplotype.variants:             # <<<<<<<<<<<<<<
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 1
 * 
 */
        __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_variant, __pyx_v_haplotype->variants, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 415, __pyx_L1_error)
        __pyx_t_12 = (__pyx_t_11 != 0);
        if (__pyx_t_12) {

          /* "vcfutils.pyx":416
 * 
 *                 if variant in haplotype.variants:
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 1             # <<<<<<<<<<<<<<
 * 
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:
 */
          __pyx_t_10 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_variantsThisPos, __pyx_v_variant); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 416, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_10); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          ((__pyx_v_varThisPosInHap[__pyx_v_hapIndex])[__pyx_t_13]) = 1;

          /* "vcfutils.pyx":418
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 1
 * 
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:             # <<<<<<<<<<<<<<
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 *                 else:
 */
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_variant, __pyx_n_s_minRefPos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_14 = PyObject_RichCompare(__pyx_t_10, __pyx_v_POS, Py_LE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 418, __pyx_L1_error)
          if (__Pyx_PyObject_IsTrue(__pyx_t_14)) {
            __Pyx_DECREF(__pyx_t_14);
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_variant, __pyx_n_s_maxRefPos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 418, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_14 = PyObject_RichCompare(__pyx_v_POS, __pyx_t_15, Py_LE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 418, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 418, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (__pyx_t_12) {

            /* "vcfutils.pyx":419
 * 
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0             # <<<<<<<<<<<<<<
 *                 else:
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 0
 */
            (__pyx_v_haplotypeIsRefAtThisPos[__pyx_v_hapIndex]) = 0;

            /* "vcfutils.pyx":418
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 1
 * 
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:             # <<<<<<<<<<<<<<
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 *                 else:
 */
          }

          /* "vcfutils.pyx":415
 *             for variantIndex,variant in enumerate(variants):
 * 
 *                 if variant in haplotype.variants:             # <<<<<<<<<<<<<<
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 1
 * 
 */
          goto __pyx_L11;
        }

        /* "vcfutils.pyx":421
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 *                 else:
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 0             # <<<<<<<<<<<<<<
 * 
 *             for variantIndex,variant in enumerate(allVariants):
 */
        /*else*/ {
          __pyx_t_14 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_variantsThisPos, __pyx_v_variant); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 421, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_14); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 421, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          ((__pyx_v_varThisPosInHap[__pyx_v_hapIndex])[__pyx_t_13]) = 0;
        }
        __pyx_L11:;

        /* "vcfutils.pyx":413
 *             haplotypeIsRefAtThisPos[hapIndex] = 1
 * 
 *             for variantIndex,variant in enumerate(variants):             # <<<<<<<<<<<<<<
 * 
 *                 if variant in haplotype.variants:
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":423
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 0
 * 
 *             for variantIndex,variant in enumerate(allVariants):             # <<<<<<<<<<<<<<
 * 
 *                 if variant in haplotype.variants:
 */
      __pyx_t_9 = 0;
      __pyx_t_3 = __pyx_v_allVariants; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      for (;;) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_14 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_14); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 423, __pyx_L1_error)
        #else
        __pyx_t_14 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_variant, __pyx_t_14);
        __pyx_t_14 = 0;
        __pyx_v_variantIndex = __pyx_t_9;
        __pyx_t_9 = (__pyx_t_9 + 1);

        /* "vcfutils.pyx":425
 *             for variantIndex,variant in enumerate(allVariants):
 * 
 *                 if variant in haplotype.variants:             # <<<<<<<<<<<<<<
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 */
        __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_v_variant, __pyx_v_haplotype->variants, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 425, __pyx_L1_error)
        __pyx_t_11 = (__pyx_t_12 != 0);
        if (__pyx_t_11) {

          /* "vcfutils.pyx":426
 * 
 *                 if variant in haplotype.variants:
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:             # <<<<<<<<<<<<<<
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 * 
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_variant, __pyx_n_s_minRefPos); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_10 = PyObject_RichCompare(__pyx_t_14, __pyx_v_POS, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 426, __pyx_L1_error)
          if (__Pyx_PyObject_IsTrue(__pyx_t_10)) {
            __Pyx_DECREF(__pyx_t_10);
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_variant, __pyx_n_s_maxRefPos); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 426, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_10 = PyObject_RichCompare(__pyx_v_POS, __pyx_t_15, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 426, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (__pyx_t_11) {

            /* "vcfutils.pyx":427
 *                 if variant in haplotype.variants:
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0             # <<<<<<<<<<<<<<
 * 
 *         if options.verbosity >= 3:
 */
            (__pyx_v_haplotypeIsRefAtThisPos[__pyx_v_hapIndex]) = 0;

            /* "vcfutils.pyx":426
 * 
 *                 if variant in haplotype.variants:
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:             # <<<<<<<<<<<<<<
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 * 
 */
          }

          /* "vcfutils.pyx":425
 *             for variantIndex,variant in enumerate(allVariants):
 * 
 *                 if variant in haplotype.variants:             # <<<<<<<<<<<<<<
 *                     if variant.minRefPos <= POS <= variant.maxRefPos:
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 */
        }

        /* "vcfutils.pyx":423
 *                     varThisPosInHap[hapIndex][variantsThisPos.index(variant)] = 0
 * 
 *             for variantIndex,variant in enumerate(allVariants):             # <<<<<<<<<<<<<<
 * 
 *                 if variant in haplotype.variants:
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":409
 * 
 *         # Store boolean flag saying if each haplotype is reference at this position, for use in genotype/likelihood computation
 *         for hapIndex,haplotype in enumerate(haplotypes):             # <<<<<<<<<<<<<<
 * 
 *             haplotypeIsRefAtThisPos[hapIndex] = 1
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":429
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 * 
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("Haps are %s" %(haplotypes))
 *             logger.debug("Logging mutated sequences...")
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_11) {

      /* "vcfutils.pyx":430
 * 
 *         if options.verbosity >= 3:
 *             logger.debug("Haps are %s" %(haplotypes))             # <<<<<<<<<<<<<<
 *             logger.debug("Logging mutated sequences...")
 *             logger.debug("Lengths are %s" %([len(str(haplotype.getMutatedSequence())) for haplotype in haplotypes]))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Haps_are_s, __pyx_v_haplotypes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_3 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_14, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":431
 *         if options.verbosity >= 3:
 *             logger.debug("Haps are %s" %(haplotypes))
 *             logger.debug("Logging mutated sequences...")             # <<<<<<<<<<<<<<
 *             logger.debug("Lengths are %s" %([len(str(haplotype.getMutatedSequence())) for haplotype in haplotypes]))
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_logger); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 431, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_kp_s_Logging_mutated_sequences) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Logging_mutated_sequences);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __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;

      /* "vcfutils.pyx":432
 *             logger.debug("Haps are %s" %(haplotypes))
 *             logger.debug("Logging mutated sequences...")
 *             logger.debug("Lengths are %s" %([len(str(haplotype.getMutatedSequence())) for haplotype in haplotypes]))             # <<<<<<<<<<<<<<
 * 
 *             for haplotype in haplotypes:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 432, __pyx_L1_error)
      }
      __pyx_t_14 = __pyx_v_haplotypes; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
      for (;;) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_15 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_15); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 432, __pyx_L1_error)
        #else
        __pyx_t_15 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        #endif
        if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_haplotype, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_15));
        __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_haplotype->__pyx_vtab)->getMutatedSequence(__pyx_v_haplotype)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_16 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_8 = PyObject_Length(__pyx_t_16); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __Pyx_PyString_Format(__pyx_kp_s_Lengths_are_s, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_4, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":434
 *             logger.debug("Lengths are %s" %([len(str(haplotype.getMutatedSequence())) for haplotype in haplotypes]))
 * 
 *             for haplotype in haplotypes:             # <<<<<<<<<<<<<<
 *                 logger.debug(str(haplotype.getMutatedSequence())[50:-50])
 * 
 */
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 434, __pyx_L1_error)
      }
      __pyx_t_3 = __pyx_v_haplotypes; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
      for (;;) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 434, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 434, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 434, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_haplotype, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_10));
        __pyx_t_10 = 0;

        /* "vcfutils.pyx":435
 * 
 *             for haplotype in haplotypes:
 *                 logger.debug(str(haplotype.getMutatedSequence())[50:-50])             # <<<<<<<<<<<<<<
 * 
 *             logger.debug("Unfiltered variants are %s" %(sorted(variants)))
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyBytes_FromString(((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_haplotype->__pyx_vtab)->getMutatedSequence(__pyx_v_haplotype)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_16 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetSlice(__pyx_t_16, 50, -50L, NULL, NULL, &__pyx_slice_, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_10 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_14);
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "vcfutils.pyx":434
 *             logger.debug("Lengths are %s" %([len(str(haplotype.getMutatedSequence())) for haplotype in haplotypes]))
 * 
 *             for haplotype in haplotypes:             # <<<<<<<<<<<<<<
 *                 logger.debug(str(haplotype.getMutatedSequence())[50:-50])
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":437
 *                 logger.debug(str(haplotype.getMutatedSequence())[50:-50])
 * 
 *             logger.debug("Unfiltered variants are %s" %(sorted(variants)))             # <<<<<<<<<<<<<<
 *             logger.debug("Var info = %s" %(info))
 *             logger.debug("Unfiltered variant info is %s" %([info[v] for v in sorted(variants)]))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_logger); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_14 = PySequence_List(__pyx_v_variants); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_10 = ((PyObject*)__pyx_t_14);
      __pyx_t_14 = 0;
      __pyx_t_5 = PyList_Sort(__pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 437, __pyx_L1_error)
      __pyx_t_14 = __Pyx_PyString_Format(__pyx_kp_s_Unfiltered_variants_are_s, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __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;

      /* "vcfutils.pyx":438
 * 
 *             logger.debug("Unfiltered variants are %s" %(sorted(variants)))
 *             logger.debug("Var info = %s" %(info))             # <<<<<<<<<<<<<<
 *             logger.debug("Unfiltered variant info is %s" %([info[v] for v in sorted(variants)]))
 *             logger.debug("NVariants = %s" %(nVariants))
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Var_info_s, __pyx_v_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":439
 *             logger.debug("Unfiltered variants are %s" %(sorted(variants)))
 *             logger.debug("Var info = %s" %(info))
 *             logger.debug("Unfiltered variant info is %s" %([info[v] for v in sorted(variants)]))             # <<<<<<<<<<<<<<
 *             logger.debug("NVariants = %s" %(nVariants))
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_logger); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_16 = PySequence_List(__pyx_v_variants); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_10 = ((PyObject*)__pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_5 = PyList_Sort(__pyx_t_10); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 439, __pyx_L1_error)
      if (unlikely(__pyx_t_10 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 439, __pyx_L1_error)
      }
      __pyx_t_16 = __pyx_t_10; __Pyx_INCREF(__pyx_t_16); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      for (;;) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_16)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_7); __Pyx_INCREF(__pyx_t_10); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_16, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_10);
        __pyx_t_10 = 0;
        if (unlikely(__pyx_v_info == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 439, __pyx_L1_error)
        }
        __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_v); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 439, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_Unfiltered_variant_info_is_s, __pyx_t_14); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 439, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_14, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_16);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 439, __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;

      /* "vcfutils.pyx":440
 *             logger.debug("Var info = %s" %(info))
 *             logger.debug("Unfiltered variant info is %s" %([info[v] for v in sorted(variants)]))
 *             logger.debug("NVariants = %s" %(nVariants))             # <<<<<<<<<<<<<<
 * 
 *         chrom = variants[0].refName
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logger); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nVariants); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyString_Format(__pyx_kp_s_NVariants_s, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
        }
      }
      __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_4, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_14);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":429
 *                         haplotypeIsRefAtThisPos[hapIndex] = 0
 * 
 *         if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *             logger.debug("Haps are %s" %(haplotypes))
 *             logger.debug("Logging mutated sequences...")
 */
    }

    /* "vcfutils.pyx":442
 *             logger.debug("NVariants = %s" %(nVariants))
 * 
 *         chrom = variants[0].refName             # <<<<<<<<<<<<<<
 *         ref,alt = refAndAlt(chrom, POS, variants, refFile)
 *         theId = "."
 */
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 442, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_variants, 0), __pyx_n_s_refName); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_chrom, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":443
 * 
 *         chrom = variants[0].refName
 *         ref,alt = refAndAlt(chrom, POS, variants, refFile)             # <<<<<<<<<<<<<<
 *         theId = "."
 *         #id = "."#str(-1)
 */
    __pyx_t_17 = __Pyx_PyObject_AsWritableString(__pyx_v_chrom); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_POS); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_8vcfutils_refAndAlt(__pyx_t_17, __pyx_t_2, __pyx_v_variants, __pyx_v_refFile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(__pyx_t_3 != Py_None)) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 443, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 443, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 443, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_ref, __pyx_t_16);
    __pyx_t_16 = 0;
    __Pyx_XDECREF_SET(__pyx_v_alt, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "vcfutils.pyx":444
 *         chrom = variants[0].refName
 *         ref,alt = refAndAlt(chrom, POS, variants, refFile)
 *         theId = "."             # <<<<<<<<<<<<<<
 *         #id = "."#str(-1)
 *         qual = -1
 */
    __Pyx_INCREF(__pyx_kp_s__2);
    __Pyx_XDECREF_SET(__pyx_v_theId, __pyx_kp_s__2);

    /* "vcfutils.pyx":446
 *         theId = "."
 *         #id = "."#str(-1)
 *         qual = -1             # <<<<<<<<<<<<<<
 *         format = ['GT:GL:GOF:GQ:NR:NV']
 *         linefilter = []
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_XDECREF_SET(__pyx_v_qual, __pyx_int_neg_1);

    /* "vcfutils.pyx":447
 *         #id = "."#str(-1)
 *         qual = -1
 *         format = ['GT:GL:GOF:GQ:NR:NV']             # <<<<<<<<<<<<<<
 *         linefilter = []
 *         lineinfo = info[variants[0]]
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
    __Pyx_GIVEREF(__pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_GT_GL_GOF_GQ_NR_NV);
    __Pyx_XDECREF_SET(__pyx_v_format, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":448
 *         qual = -1
 *         format = ['GT:GL:GOF:GQ:NR:NV']
 *         linefilter = []             # <<<<<<<<<<<<<<
 *         lineinfo = info[variants[0]]
 *         FR = []             # Can be generalised to all fields of variable length
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_linefilter, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":449
 *         format = ['GT:GL:GOF:GQ:NR:NV']
 *         linefilter = []
 *         lineinfo = info[variants[0]]             # <<<<<<<<<<<<<<
 *         FR = []             # Can be generalised to all fields of variable length
 *         PP = []
 */
    if (unlikely(__pyx_v_info == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 449, __pyx_L1_error)
    }
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 449, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_info, PyList_GET_ITEM(__pyx_v_variants, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 449, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_lineinfo, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":450
 *         linefilter = []
 *         lineinfo = info[variants[0]]
 *         FR = []             # Can be generalised to all fields of variable length             # <<<<<<<<<<<<<<
 *         PP = []
 *         NF = []
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_FR, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":451
 *         lineinfo = info[variants[0]]
 *         FR = []             # Can be generalised to all fields of variable length
 *         PP = []             # <<<<<<<<<<<<<<
 *         NF = []
 *         NR = []
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_PP, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":452
 *         FR = []             # Can be generalised to all fields of variable length
 *         PP = []
 *         NF = []             # <<<<<<<<<<<<<<
 *         NR = []
 *         TR = []
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_NF, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":453
 *         PP = []
 *         NF = []
 *         NR = []             # <<<<<<<<<<<<<<
 *         TR = []
 * 
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_NR, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":454
 *         NF = []
 *         NR = []
 *         TR = []             # <<<<<<<<<<<<<<
 * 
 *         for var in variants:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_TR, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":456
 *         TR = []
 * 
 *         for var in variants:             # <<<<<<<<<<<<<<
 * 
 *             #logger.debug("Info for variant %s is %s" %(var, info[var]))
 */
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 456, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    for (;;) {
      if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_14 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_14); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 456, __pyx_L1_error)
      #else
      __pyx_t_14 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_var, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "vcfutils.pyx":459
 * 
 *             #logger.debug("Info for variant %s is %s" %(var, info[var]))
 *             linefilter.extend( [f for f in vcfFilter[var] if ( f in vcfFile.getfilter() )] )             # <<<<<<<<<<<<<<
 * 
 *             freq = info[var]['FR']
 */
      __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 459, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (unlikely(__pyx_v_vcfFilter == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 459, __pyx_L1_error)
      }
      __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_vcfFilter, __pyx_v_var); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 459, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (likely(PyList_CheckExact(__pyx_t_16)) || PyTuple_CheckExact(__pyx_t_16)) {
        __pyx_t_4 = __pyx_t_16; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
        __pyx_t_18 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 459, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      for (;;) {
        if (likely(!__pyx_t_18)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_16 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_16); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
            #else
            __pyx_t_16 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 459, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_16);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_16 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_16); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
            #else
            __pyx_t_16 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 459, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_16);
            #endif
          }
        } else {
          __pyx_t_16 = __pyx_t_18(__pyx_t_4);
          if (unlikely(!__pyx_t_16)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 459, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_16);
        }
        __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_16);
        __pyx_t_16 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_vcfFile, __pyx_n_s_getfilter); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 459, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_16 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 459, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_f, __pyx_t_16, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_12 = (__pyx_t_11 != 0);
        if (__pyx_t_12) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_v_f))) __PYX_ERR(0, 459, __pyx_L1_error)
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_linefilter, __pyx_t_14); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 459, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "vcfutils.pyx":461
 *             linefilter.extend( [f for f in vcfFilter[var] if ( f in vcfFile.getfilter() )] )
 * 
 *             freq = info[var]['FR']             # <<<<<<<<<<<<<<
 *             posterior = info[var]['PP']
 *             varTR = info[var]['TR']
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 461, __pyx_L1_error)
      }
      __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_var); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_14, __pyx_n_s_FR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_freq, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":462
 * 
 *             freq = info[var]['FR']
 *             posterior = info[var]['PP']             # <<<<<<<<<<<<<<
 *             varTR = info[var]['TR']
 *             varNF = info[var]['NF']
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 462, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_var); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_s_PP); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_posterior, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "vcfutils.pyx":463
 *             freq = info[var]['FR']
 *             posterior = info[var]['PP']
 *             varTR = info[var]['TR']             # <<<<<<<<<<<<<<
 *             varNF = info[var]['NF']
 *             varNR = info[var]['NR']
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 463, __pyx_L1_error)
      }
      __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_var); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_14, __pyx_n_s_TR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_varTR, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":464
 *             posterior = info[var]['PP']
 *             varTR = info[var]['TR']
 *             varNF = info[var]['NF']             # <<<<<<<<<<<<<<
 *             varNR = info[var]['NR']
 * 
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 464, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_var); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_s_NF); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 464, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_varNF, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "vcfutils.pyx":465
 *             varTR = info[var]['TR']
 *             varNF = info[var]['NF']
 *             varNR = info[var]['NR']             # <<<<<<<<<<<<<<
 * 
 *             FR.extend(freq)
 */
      if (unlikely(__pyx_v_info == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 465, __pyx_L1_error)
      }
      __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_info, __pyx_v_var); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_14, __pyx_n_s_NR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_varNR, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":467
 *             varNR = info[var]['NR']
 * 
 *             FR.extend(freq)             # <<<<<<<<<<<<<<
 *             PP.extend(posterior)
 *             NR.extend(varNR)
 */
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_FR, __pyx_v_freq); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 467, __pyx_L1_error)

      /* "vcfutils.pyx":468
 * 
 *             FR.extend(freq)
 *             PP.extend(posterior)             # <<<<<<<<<<<<<<
 *             NR.extend(varNR)
 *             NF.extend(varNF)
 */
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_PP, __pyx_v_posterior); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 468, __pyx_L1_error)

      /* "vcfutils.pyx":469
 *             FR.extend(freq)
 *             PP.extend(posterior)
 *             NR.extend(varNR)             # <<<<<<<<<<<<<<
 *             NF.extend(varNF)
 *             TR.extend(varTR)
 */
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_NR, __pyx_v_varNR); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 469, __pyx_L1_error)

      /* "vcfutils.pyx":470
 *             PP.extend(posterior)
 *             NR.extend(varNR)
 *             NF.extend(varNF)             # <<<<<<<<<<<<<<
 *             TR.extend(varTR)
 * 
 */
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_NF, __pyx_v_varNF); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 470, __pyx_L1_error)

      /* "vcfutils.pyx":471
 *             NR.extend(varNR)
 *             NF.extend(varNF)
 *             TR.extend(varTR)             # <<<<<<<<<<<<<<
 * 
 *         lineinfo['WS'] = [windowStart]
 */
      __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_TR, __pyx_v_varTR); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 471, __pyx_L1_error)

      /* "vcfutils.pyx":456
 *         TR = []
 * 
 *         for var in variants:             # <<<<<<<<<<<<<<
 * 
 *             #logger.debug("Info for variant %s is %s" %(var, info[var]))
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":473
 *             TR.extend(varTR)
 * 
 *         lineinfo['WS'] = [windowStart]             # <<<<<<<<<<<<<<
 *         lineinfo['WE'] = [windowEnd]
 *         lineinfo['FR'] = FR
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 473, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_WS, __pyx_t_4) < 0)) __PYX_ERR(0, 473, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":474
 * 
 *         lineinfo['WS'] = [windowStart]
 *         lineinfo['WE'] = [windowEnd]             # <<<<<<<<<<<<<<
 *         lineinfo['FR'] = FR
 *         lineinfo['PP'] = PP
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 474, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_WE, __pyx_t_3) < 0)) __PYX_ERR(0, 474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":475
 *         lineinfo['WS'] = [windowStart]
 *         lineinfo['WE'] = [windowEnd]
 *         lineinfo['FR'] = FR             # <<<<<<<<<<<<<<
 *         lineinfo['PP'] = PP
 *         lineinfo['NF'] = NF
 */
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 475, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_FR, __pyx_v_FR) < 0)) __PYX_ERR(0, 475, __pyx_L1_error)

    /* "vcfutils.pyx":476
 *         lineinfo['WE'] = [windowEnd]
 *         lineinfo['FR'] = FR
 *         lineinfo['PP'] = PP             # <<<<<<<<<<<<<<
 *         lineinfo['NF'] = NF
 *         lineinfo['NR'] = NR
 */
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 476, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_PP, __pyx_v_PP) < 0)) __PYX_ERR(0, 476, __pyx_L1_error)

    /* "vcfutils.pyx":477
 *         lineinfo['FR'] = FR
 *         lineinfo['PP'] = PP
 *         lineinfo['NF'] = NF             # <<<<<<<<<<<<<<
 *         lineinfo['NR'] = NR
 *         lineinfo['TR'] = TR
 */
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 477, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_NF, __pyx_v_NF) < 0)) __PYX_ERR(0, 477, __pyx_L1_error)

    /* "vcfutils.pyx":478
 *         lineinfo['PP'] = PP
 *         lineinfo['NF'] = NF
 *         lineinfo['NR'] = NR             # <<<<<<<<<<<<<<
 *         lineinfo['TR'] = TR
 * 
 */
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 478, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_NR, __pyx_v_NR) < 0)) __PYX_ERR(0, 478, __pyx_L1_error)

    /* "vcfutils.pyx":479
 *         lineinfo['NF'] = NF
 *         lineinfo['NR'] = NR
 *         lineinfo['TR'] = TR             # <<<<<<<<<<<<<<
 * 
 *         linefilter = list(set(linefilter))
 */
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 479, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_lineinfo, __pyx_n_s_TR, __pyx_v_TR) < 0)) __PYX_ERR(0, 479, __pyx_L1_error)

    /* "vcfutils.pyx":481
 *         lineinfo['TR'] = TR
 * 
 *         linefilter = list(set(linefilter))             # <<<<<<<<<<<<<<
 *         qual = max([int(pp) for pp in lineinfo['PP']])
 *         vcfDataLine = {'chrom':chrom,'pos':POS,'ref':ref,'alt':alt,'id':theId,'info':lineinfo,'filter':linefilter,'qual':qual,'format':format}
 */
    __pyx_t_3 = PySet_New(__pyx_v_linefilter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_linefilter, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":482
 * 
 *         linefilter = list(set(linefilter))
 *         qual = max([int(pp) for pp in lineinfo['PP']])             # <<<<<<<<<<<<<<
 *         vcfDataLine = {'chrom':chrom,'pos':POS,'ref':ref,'alt':alt,'id':theId,'info':lineinfo,'filter':linefilter,'qual':qual,'format':format}
 * 
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_lineinfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 482, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_lineinfo, __pyx_n_s_PP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_14 = __pyx_t_3; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
      __pyx_t_18 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_18 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 482, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_18)) {
        if (likely(PyList_CheckExact(__pyx_t_14))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_14)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_18(__pyx_t_14);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 482, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_pp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_qual, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "vcfutils.pyx":483
 *         linefilter = list(set(linefilter))
 *         qual = max([int(pp) for pp in lineinfo['PP']])
 *         vcfDataLine = {'chrom':chrom,'pos':POS,'ref':ref,'alt':alt,'id':theId,'info':lineinfo,'filter':linefilter,'qual':qual,'format':format}             # <<<<<<<<<<<<<<
 * 
 *         # Now pull out the genotype informations for each sample, and compute genotype likelihoods and
 */
    __pyx_t_14 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_chrom, __pyx_v_chrom) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_pos, __pyx_v_POS) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_ref, __pyx_v_ref) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_alt, __pyx_v_alt) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_id, __pyx_v_theId) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_info, __pyx_v_lineinfo) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_filter, __pyx_v_linefilter) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_qual, __pyx_v_qual) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_format, __pyx_v_format) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_vcfDataLine, ((PyObject*)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "vcfutils.pyx":487
 *         # Now pull out the genotype informations for each sample, and compute genotype likelihoods and
 *         # Phred-based qualities scores.
 *         theVar = variants[0]             # <<<<<<<<<<<<<<
 *         gofsThisPos = []
 *         nNonRefCalls = 0
 */
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 487, __pyx_L1_error)
    }
    __pyx_t_14 = PyList_GET_ITEM(__pyx_v_variants, 0);
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_XDECREF_SET(__pyx_v_theVar, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "vcfutils.pyx":488
 *         # Phred-based qualities scores.
 *         theVar = variants[0]
 *         gofsThisPos = []             # <<<<<<<<<<<<<<
 *         nNonRefCalls = 0
 * 
 */
    __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 488, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_XDECREF_SET(__pyx_v_gofsThisPos, ((PyObject*)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "vcfutils.pyx":489
 *         theVar = variants[0]
 *         gofsThisPos = []
 *         nNonRefCalls = 0             # <<<<<<<<<<<<<<
 * 
 *         for i from 0 <= i < nIndividuals:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_nNonRefCalls, __pyx_int_0);

    /* "vcfutils.pyx":491
 *         nNonRefCalls = 0
 * 
 *         for i from 0 <= i < nIndividuals:             # <<<<<<<<<<<<<<
 * 
 *             theBuffer = readBuffers[i]
 */
    __pyx_t_2 = __pyx_v_nIndividuals;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) {

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

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

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

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

        /* "vcfutils.pyx":499
 *             if theBuffer.reads.windowEnd - theBuffer.reads.windowStart == 0:
 *                 vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=[0,0,0], GQ=[0],GOF=[0],NR=[0], NV=[0])
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             # Have genotype. Need to construct call string ("0/1" etc), and compute likelihoods
 */
        goto __pyx_L31_continue;

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

      /* "vcfutils.pyx":505
 *             else:
 *                 #logger.info("nReads for sample %s = %s" %(thisSample, theBuffer.reads.windowEnd - theBuffer.reads.windowStart))
 *                 (index1,index2,likelihoods,genotypePosterior,nonRefPosterior,refPosterior,gofValue) = computeGenotypeCallAndLikelihoods(POS, haplotypes, genotypes, i, haplotypeFrequencies, genotypeLikelihoods, gofValues, haplotypeIndexes, varThisPosInHap, variantsThisPos, haplotypeIsRefAtThisPos, nIndividuals, thisSample)             # <<<<<<<<<<<<<<
 * 
 *                 if not (index1 == 0 and index2 == 0):
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_POS); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __pyx_t_14 = __pyx_f_8vcfutils_computeGenotypeCallAndLikelihoods(__pyx_t_9, __pyx_v_haplotypes, __pyx_v_genotypes, __pyx_v_i, __pyx_v_haplotypeFrequencies, __pyx_v_genotypeLikelihoods, __pyx_v_gofValues, __pyx_v_haplotypeIndexes, __pyx_v_varThisPosInHap, __pyx_v_variantsThisPos, __pyx_v_haplotypeIsRefAtThisPos, __pyx_v_nIndividuals, __pyx_v_thisSample); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (likely(__pyx_t_14 != Py_None)) {
          PyObject* sequence = __pyx_t_14;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 7)) {
            if (size > 7) __Pyx_RaiseTooManyValuesError(7);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 505, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_16 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_20 = PyTuple_GET_ITEM(sequence, 6); 
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_20);
          #else
          {
            Py_ssize_t i;
            PyObject** temps[7] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_16,&__pyx_t_10,&__pyx_t_15,&__pyx_t_19,&__pyx_t_20};
            for (i=0; i < 7; i++) {
              PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 505, __pyx_L1_error)
              __Pyx_GOTREF(item);
              *(temps[i]) = item;
            }
          }
          #endif
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else {
          __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 505, __pyx_L1_error)
        }
        __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_21 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_21 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(PyList_CheckExact(__pyx_t_16))||((__pyx_t_16) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_16)->tp_name), 0))) __PYX_ERR(0, 505, __pyx_L1_error)
        __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 505, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_v_index1 = __pyx_t_9;
        __pyx_v_index2 = __pyx_t_21;
        __Pyx_DECREF_SET(__pyx_v_likelihoods, ((PyObject*)__pyx_t_16));
        __pyx_t_16 = 0;
        __pyx_v_genotypePosterior = __pyx_t_22;
        __pyx_v_nonRefPosterior = __pyx_t_23;
        __pyx_v_refPosterior = __pyx_t_24;
        __pyx_v_gofValue = __pyx_t_25;

        /* "vcfutils.pyx":507
 *                 (index1,index2,likelihoods,genotypePosterior,nonRefPosterior,refPosterior,gofValue) = computeGenotypeCallAndLikelihoods(POS, haplotypes, genotypes, i, haplotypeFrequencies, genotypeLikelihoods, gofValues, haplotypeIndexes, varThisPosInHap, variantsThisPos, haplotypeIsRefAtThisPos, nIndividuals, thisSample)
 * 
 *                 if not (index1 == 0 and index2 == 0):             # <<<<<<<<<<<<<<
 *                     gofsThisPos.append(gofValue)
 *                     nNonRefCalls += 1
 */
        __pyx_t_11 = ((__pyx_v_index1 == 0) != 0);
        if (__pyx_t_11) {
        } else {
          __pyx_t_12 = __pyx_t_11;
          goto __pyx_L35_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_index2 == 0) != 0);
        __pyx_t_12 = __pyx_t_11;
        __pyx_L35_bool_binop_done:;
        __pyx_t_11 = ((!__pyx_t_12) != 0);
        if (__pyx_t_11) {

          /* "vcfutils.pyx":508
 * 
 *                 if not (index1 == 0 and index2 == 0):
 *                     gofsThisPos.append(gofValue)             # <<<<<<<<<<<<<<
 *                     nNonRefCalls += 1
 * 
 */
          __pyx_t_14 = PyFloat_FromDouble(__pyx_v_gofValue); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_gofsThisPos, __pyx_t_14); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 508, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "vcfutils.pyx":509
 *                 if not (index1 == 0 and index2 == 0):
 *                     gofsThisPos.append(gofValue)
 *                     nNonRefCalls += 1             # <<<<<<<<<<<<<<
 * 
 *                 GT = [str(index1), "/", str(index2)]
 */
          __pyx_t_14 = __Pyx_PyInt_AddObjC(__pyx_v_nNonRefCalls, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 509, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF_SET(__pyx_v_nNonRefCalls, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":507
 *                 (index1,index2,likelihoods,genotypePosterior,nonRefPosterior,refPosterior,gofValue) = computeGenotypeCallAndLikelihoods(POS, haplotypes, genotypes, i, haplotypeFrequencies, genotypeLikelihoods, gofValues, haplotypeIndexes, varThisPosInHap, variantsThisPos, haplotypeIsRefAtThisPos, nIndividuals, thisSample)
 * 
 *                 if not (index1 == 0 and index2 == 0):             # <<<<<<<<<<<<<<
 *                     gofsThisPos.append(gofValue)
 *                     nNonRefCalls += 1
 */
        }

        /* "vcfutils.pyx":511
 *                     nNonRefCalls += 1
 * 
 *                 GT = [str(index1), "/", str(index2)]             # <<<<<<<<<<<<<<
 *                 phredPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-genotypePosterior)))))
 *                 phredNonRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-nonRefPosterior)))))
 */
        __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_20 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_14); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_index2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_19 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = PyList_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_20);
        PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_20);
        __Pyx_INCREF(__pyx_kp_s__3);
        __Pyx_GIVEREF(__pyx_kp_s__3);
        PyList_SET_ITEM(__pyx_t_14, 1, __pyx_kp_s__3);
        __Pyx_GIVEREF(__pyx_t_19);
        PyList_SET_ITEM(__pyx_t_14, 2, __pyx_t_19);
        __pyx_t_20 = 0;
        __pyx_t_19 = 0;
        __Pyx_XDECREF_SET(__pyx_v_GT, ((PyObject*)__pyx_t_14));
        __pyx_t_14 = 0;

        /* "vcfutils.pyx":512
 * 
 *                 GT = [str(index1), "/", str(index2)]
 *                 phredPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-genotypePosterior)))))             # <<<<<<<<<<<<<<
 *                 phredNonRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-nonRefPosterior)))))
 *                 phredRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-refPosterior)))))
 */
        __pyx_t_25 = (1.0 - __pyx_v_genotypePosterior);
        __pyx_t_24 = 1e-10;
        if (((__pyx_t_25 > __pyx_t_24) != 0)) {
          __pyx_t_23 = __pyx_t_25;
        } else {
          __pyx_t_23 = __pyx_t_24;
        }
        __pyx_t_14 = PyFloat_FromDouble((-10.0 * log10(__pyx_t_23))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_19 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_26 = 99;
        __pyx_t_20 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_15 = PyObject_RichCompare(__pyx_t_19, __pyx_t_20, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (__pyx_t_11) {
          __Pyx_INCREF(__pyx_t_19);
          __pyx_t_14 = __pyx_t_19;
        } else {
          __pyx_t_15 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 512, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_14 = __pyx_t_15;
          __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_t_19 = __Pyx_PyNumber_Int(__pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF_SET(__pyx_v_phredPosterior, __pyx_t_19);
        __pyx_t_19 = 0;

        /* "vcfutils.pyx":513
 *                 GT = [str(index1), "/", str(index2)]
 *                 phredPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-genotypePosterior)))))
 *                 phredNonRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-nonRefPosterior)))))             # <<<<<<<<<<<<<<
 *                 phredRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-refPosterior)))))
 * 
 */
        __pyx_t_23 = (1.0 - __pyx_v_nonRefPosterior);
        __pyx_t_25 = 1e-10;
        if (((__pyx_t_23 > __pyx_t_25) != 0)) {
          __pyx_t_24 = __pyx_t_23;
        } else {
          __pyx_t_24 = __pyx_t_25;
        }
        __pyx_t_19 = PyFloat_FromDouble((-10.0 * log10(__pyx_t_24))); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_t_26 = 99;
        __pyx_t_15 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_20 = PyObject_RichCompare(__pyx_t_14, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_20); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_20); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        if (__pyx_t_11) {
          __Pyx_INCREF(__pyx_t_14);
          __pyx_t_19 = __pyx_t_14;
        } else {
          __pyx_t_20 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 513, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_19 = __pyx_t_20;
          __pyx_t_20 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF_SET(__pyx_v_phredNonRefPosterior, __pyx_t_14);
        __pyx_t_14 = 0;

        /* "vcfutils.pyx":514
 *                 phredPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-genotypePosterior)))))
 *                 phredNonRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-nonRefPosterior)))))
 *                 phredRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-refPosterior)))))             # <<<<<<<<<<<<<<
 * 
 *                 if options.verbosity >= 3:
 */
        __pyx_t_24 = (1.0 - __pyx_v_refPosterior);
        __pyx_t_23 = 1e-10;
        if (((__pyx_t_24 > __pyx_t_23) != 0)) {
          __pyx_t_25 = __pyx_t_24;
        } else {
          __pyx_t_25 = __pyx_t_23;
        }
        __pyx_t_14 = PyFloat_FromDouble((-10.0 * log10(__pyx_t_25))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_19 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_26 = 99;
        __pyx_t_20 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_15 = PyObject_RichCompare(__pyx_t_19, __pyx_t_20, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (__pyx_t_11) {
          __Pyx_INCREF(__pyx_t_19);
          __pyx_t_14 = __pyx_t_19;
        } else {
          __pyx_t_15 = __Pyx_PyInt_From_long(__pyx_t_26); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 514, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_14 = __pyx_t_15;
          __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_t_19 = __Pyx_PyNumber_Int(__pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 514, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF_SET(__pyx_v_phredRefPosterior, __pyx_t_19);
        __pyx_t_19 = 0;

        /* "vcfutils.pyx":516
 *                 phredRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-refPosterior)))))
 * 
 *                 if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                     logger.debug("Sample %s has genotype posterior = %s. non-ref posterior = %s. Ref posterior = %s." %(thisSample,phredPosterior, phredNonRefPosterior, phredRefPosterior))
 * 
 */
        __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_14 = PyObject_RichCompare(__pyx_t_19, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (__pyx_t_11) {

          /* "vcfutils.pyx":517
 * 
 *                 if options.verbosity >= 3:
 *                     logger.debug("Sample %s has genotype posterior = %s. non-ref posterior = %s. Ref posterior = %s." %(thisSample,phredPosterior, phredNonRefPosterior, phredRefPosterior))             # <<<<<<<<<<<<<<
 * 
 *                 # Don't make a call if the non-ref posterior is too low
 */
          __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_logger); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_debug); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_INCREF(__pyx_v_thisSample);
          __Pyx_GIVEREF(__pyx_v_thisSample);
          PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_thisSample);
          __Pyx_INCREF(__pyx_v_phredPosterior);
          __Pyx_GIVEREF(__pyx_v_phredPosterior);
          PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_phredPosterior);
          __Pyx_INCREF(__pyx_v_phredNonRefPosterior);
          __Pyx_GIVEREF(__pyx_v_phredNonRefPosterior);
          PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_v_phredNonRefPosterior);
          __Pyx_INCREF(__pyx_v_phredRefPosterior);
          __Pyx_GIVEREF(__pyx_v_phredRefPosterior);
          PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_v_phredRefPosterior);
          __pyx_t_20 = __Pyx_PyString_Format(__pyx_kp_s_Sample_s_has_genotype_posterior, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_19 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_19)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_19);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
            }
          }
          __pyx_t_14 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_19, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_20);
          __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "vcfutils.pyx":516
 *                 phredRefPosterior = int(min(99, round(-10.0*log10(max(1e-10, 1.0-refPosterior)))))
 * 
 *                 if options.verbosity >= 3:             # <<<<<<<<<<<<<<
 *                     logger.debug("Sample %s has genotype posterior = %s. non-ref posterior = %s. Ref posterior = %s." %(thisSample,phredPosterior, phredNonRefPosterior, phredRefPosterior))
 * 
 */
        }

        /* "vcfutils.pyx":520
 * 
 *                 # Don't make a call if the non-ref posterior is too low
 *                 if nVariants == 1 and phredNonRefPosterior < options.minPosterior and phredRefPosterior < options.minPosterior:             # <<<<<<<<<<<<<<
 *                     GT = [".", "/", "."]
 *                     maxLikelihood = max(likelihoods)
 */
        __pyx_t_12 = ((__pyx_v_nVariants == 1) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_11 = __pyx_t_12;
          goto __pyx_L39_bool_binop_done;
        }
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minPosterior); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = PyObject_RichCompare(__pyx_v_phredNonRefPosterior, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (__pyx_t_12) {
        } else {
          __pyx_t_11 = __pyx_t_12;
          goto __pyx_L39_bool_binop_done;
        }
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minPosterior); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_14 = PyObject_RichCompare(__pyx_v_phredRefPosterior, __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 520, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_11 = __pyx_t_12;
        __pyx_L39_bool_binop_done:;
        if (__pyx_t_11) {

          /* "vcfutils.pyx":521
 *                 # Don't make a call if the non-ref posterior is too low
 *                 if nVariants == 1 and phredNonRefPosterior < options.minPosterior and phredRefPosterior < options.minPosterior:
 *                     GT = [".", "/", "."]             # <<<<<<<<<<<<<<
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 */
          __pyx_t_14 = PyList_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 521, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_INCREF(__pyx_kp_s__2);
          __Pyx_GIVEREF(__pyx_kp_s__2);
          PyList_SET_ITEM(__pyx_t_14, 0, __pyx_kp_s__2);
          __Pyx_INCREF(__pyx_kp_s__3);
          __Pyx_GIVEREF(__pyx_kp_s__3);
          PyList_SET_ITEM(__pyx_t_14, 1, __pyx_kp_s__3);
          __Pyx_INCREF(__pyx_kp_s__2);
          __Pyx_GIVEREF(__pyx_kp_s__2);
          PyList_SET_ITEM(__pyx_t_14, 2, __pyx_kp_s__2);
          __Pyx_DECREF_SET(__pyx_v_GT, ((PyObject*)__pyx_t_14));
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":522
 *                 if nVariants == 1 and phredNonRefPosterior < options.minPosterior and phredRefPosterior < options.minPosterior:
 *                     GT = [".", "/", "."]
 *                     maxLikelihood = max(likelihoods)             # <<<<<<<<<<<<<<
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 * 
 */
          __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_likelihoods); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 522, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_v_maxLikelihood = __pyx_t_25;

          /* "vcfutils.pyx":523
 *                     GT = [".", "/", "."]
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]             # <<<<<<<<<<<<<<
 * 
 *                 elif nVariants == 1 and phredNonRefPosterior < options.minPosterior:
 */
          __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (unlikely(__pyx_v_likelihoods == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 523, __pyx_L1_error)
          }
          __pyx_t_15 = __pyx_v_likelihoods; __Pyx_INCREF(__pyx_t_15); __pyx_t_7 = 0;
          for (;;) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_15)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_20 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_7); __Pyx_INCREF(__pyx_t_20); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 523, __pyx_L1_error)
            #else
            __pyx_t_20 = PySequence_ITEM(__pyx_t_15, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_20);
            __pyx_t_20 = 0;
            __pyx_t_25 = 1e-300;
            __pyx_t_20 = PyFloat_FromDouble(__pyx_v_maxLikelihood); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_10 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_16 = PyObject_RichCompare(__pyx_t_10, __pyx_t_19, Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            if (__pyx_t_11) {
              __pyx_t_16 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 523, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_20 = __pyx_t_16;
              __pyx_t_16 = 0;
            } else {
              __Pyx_INCREF(__pyx_t_19);
              __pyx_t_20 = __pyx_t_19;
            }
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_20 = PyFloat_FromDouble(log10(__pyx_t_25)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_GIVEREF(__pyx_t_20);
            PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20);
            __Pyx_INCREF(__pyx_int_2);
            __Pyx_GIVEREF(__pyx_int_2);
            PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_2);
            __pyx_t_20 = 0;
            __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_19, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_t_20))) __PYX_ERR(0, 523, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          }
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_normalisedGLs, ((PyObject*)__pyx_t_14));
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":520
 * 
 *                 # Don't make a call if the non-ref posterior is too low
 *                 if nVariants == 1 and phredNonRefPosterior < options.minPosterior and phredRefPosterior < options.minPosterior:             # <<<<<<<<<<<<<<
 *                     GT = [".", "/", "."]
 *                     maxLikelihood = max(likelihoods)
 */
          goto __pyx_L38;
        }

        /* "vcfutils.pyx":525
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 * 
 *                 elif nVariants == 1 and phredNonRefPosterior < options.minPosterior:             # <<<<<<<<<<<<<<
 *                     GT = ["0", "/", "0"]
 *                     maxLikelihood = max(likelihoods)
 */
        __pyx_t_12 = ((__pyx_v_nVariants == 1) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_11 = __pyx_t_12;
          goto __pyx_L44_bool_binop_done;
        }
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minPosterior); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = PyObject_RichCompare(__pyx_v_phredNonRefPosterior, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 525, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_11 = __pyx_t_12;
        __pyx_L44_bool_binop_done:;
        if (__pyx_t_11) {

          /* "vcfutils.pyx":526
 * 
 *                 elif nVariants == 1 and phredNonRefPosterior < options.minPosterior:
 *                     GT = ["0", "/", "0"]             # <<<<<<<<<<<<<<
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 */
          __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 526, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_kp_s_0);
          __Pyx_GIVEREF(__pyx_kp_s_0);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_kp_s_0);
          __Pyx_INCREF(__pyx_kp_s__3);
          __Pyx_GIVEREF(__pyx_kp_s__3);
          PyList_SET_ITEM(__pyx_t_15, 1, __pyx_kp_s__3);
          __Pyx_INCREF(__pyx_kp_s_0);
          __Pyx_GIVEREF(__pyx_kp_s_0);
          PyList_SET_ITEM(__pyx_t_15, 2, __pyx_kp_s_0);
          __Pyx_DECREF_SET(__pyx_v_GT, ((PyObject*)__pyx_t_15));
          __pyx_t_15 = 0;

          /* "vcfutils.pyx":527
 *                 elif nVariants == 1 and phredNonRefPosterior < options.minPosterior:
 *                     GT = ["0", "/", "0"]
 *                     maxLikelihood = max(likelihoods)             # <<<<<<<<<<<<<<
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 * 
 */
          __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_likelihoods); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 527, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 527, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_v_maxLikelihood = __pyx_t_25;

          /* "vcfutils.pyx":528
 *                     GT = ["0", "/", "0"]
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]             # <<<<<<<<<<<<<<
 * 
 *                 # Only normalise for sites which are not mult-allelic
 */
          __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 528, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (unlikely(__pyx_v_likelihoods == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 528, __pyx_L1_error)
          }
          __pyx_t_14 = __pyx_v_likelihoods; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
          for (;;) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_20 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_20); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 528, __pyx_L1_error)
            #else
            __pyx_t_20 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_20);
            __pyx_t_20 = 0;
            __pyx_t_25 = 1e-300;
            __pyx_t_20 = PyFloat_FromDouble(__pyx_v_maxLikelihood); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_16 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_10 = PyObject_RichCompare(__pyx_t_16, __pyx_t_19, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            if (__pyx_t_11) {
              __pyx_t_10 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 528, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_20 = __pyx_t_10;
              __pyx_t_10 = 0;
            } else {
              __Pyx_INCREF(__pyx_t_19);
              __pyx_t_20 = __pyx_t_19;
            }
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_20 = PyFloat_FromDouble(log10(__pyx_t_25)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_GIVEREF(__pyx_t_20);
            PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20);
            __Pyx_INCREF(__pyx_int_2);
            __Pyx_GIVEREF(__pyx_int_2);
            PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_2);
            __pyx_t_20 = 0;
            __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_19, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_20))) __PYX_ERR(0, 528, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF_SET(__pyx_v_normalisedGLs, ((PyObject*)__pyx_t_15));
          __pyx_t_15 = 0;

          /* "vcfutils.pyx":525
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 * 
 *                 elif nVariants == 1 and phredNonRefPosterior < options.minPosterior:             # <<<<<<<<<<<<<<
 *                     GT = ["0", "/", "0"]
 *                     maxLikelihood = max(likelihoods)
 */
          goto __pyx_L38;
        }

        /* "vcfutils.pyx":531
 * 
 *                 # Only normalise for sites which are not mult-allelic
 *                 elif nVariants == 1:             # <<<<<<<<<<<<<<
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 */
        __pyx_t_11 = ((__pyx_v_nVariants == 1) != 0);
        if (__pyx_t_11) {

          /* "vcfutils.pyx":532
 *                 # Only normalise for sites which are not mult-allelic
 *                 elif nVariants == 1:
 *                     maxLikelihood = max(likelihoods)             # <<<<<<<<<<<<<<
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 * 
 */
          __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_likelihoods); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 532, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_v_maxLikelihood = __pyx_t_25;

          /* "vcfutils.pyx":533
 *                 elif nVariants == 1:
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
          __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 533, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (unlikely(__pyx_v_likelihoods == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 533, __pyx_L1_error)
          }
          __pyx_t_14 = __pyx_v_likelihoods; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
          for (;;) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_20 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_20); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 533, __pyx_L1_error)
            #else
            __pyx_t_20 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_20);
            __pyx_t_20 = 0;
            __pyx_t_25 = 1e-300;
            __pyx_t_20 = PyFloat_FromDouble(__pyx_v_maxLikelihood); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_10 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __pyx_t_16 = PyObject_RichCompare(__pyx_t_10, __pyx_t_19, Py_GT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            if (__pyx_t_11) {
              __pyx_t_16 = PyFloat_FromDouble(__pyx_t_25); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 533, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_16);
              __pyx_t_20 = __pyx_t_16;
              __pyx_t_16 = 0;
            } else {
              __Pyx_INCREF(__pyx_t_19);
              __pyx_t_20 = __pyx_t_19;
            }
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_25 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
            __pyx_t_20 = PyFloat_FromDouble(log10(__pyx_t_25)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __Pyx_GIVEREF(__pyx_t_20);
            PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20);
            __Pyx_INCREF(__pyx_int_2);
            __Pyx_GIVEREF(__pyx_int_2);
            PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_int_2);
            __pyx_t_20 = 0;
            __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_19, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_20);
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_20))) __PYX_ERR(0, 533, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF_SET(__pyx_v_normalisedGLs, ((PyObject*)__pyx_t_15));
          __pyx_t_15 = 0;

          /* "vcfutils.pyx":531
 * 
 *                 # Only normalise for sites which are not mult-allelic
 *                 elif nVariants == 1:             # <<<<<<<<<<<<<<
 *                     maxLikelihood = max(likelihoods)
 *                     normalisedGLs = [round(log10(max(x / maxLikelihood, 1e-300)),2) for x in likelihoods]
 */
          goto __pyx_L38;
        }

        /* "vcfutils.pyx":537
 *                 else:
 *                     # Multi-allelic site. Don't compute likelihoods here.
 *                     normalisedGLs = [-1,-1,-1]             # <<<<<<<<<<<<<<
 * 
 *                 readsPerSample = [vcfInfo[v]['nReadsPerSample'][i] for v in variants]
 */
        /*else*/ {
          __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 537, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_int_neg_1);
          __Pyx_GIVEREF(__pyx_int_neg_1);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_int_neg_1);
          __Pyx_INCREF(__pyx_int_neg_1);
          __Pyx_GIVEREF(__pyx_int_neg_1);
          PyList_SET_ITEM(__pyx_t_15, 1, __pyx_int_neg_1);
          __Pyx_INCREF(__pyx_int_neg_1);
          __Pyx_GIVEREF(__pyx_int_neg_1);
          PyList_SET_ITEM(__pyx_t_15, 2, __pyx_int_neg_1);
          __Pyx_XDECREF_SET(__pyx_v_normalisedGLs, ((PyObject*)__pyx_t_15));
          __pyx_t_15 = 0;
        }
        __pyx_L38:;

        /* "vcfutils.pyx":539
 *                     normalisedGLs = [-1,-1,-1]
 * 
 *                 readsPerSample = [vcfInfo[v]['nReadsPerSample'][i] for v in variants]             # <<<<<<<<<<<<<<
 *                 varReadsPerSample = [vcfInfo[v]['nVarReadsPerSample'][i] for v in variants]
 * 
 */
        __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 539, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (unlikely(__pyx_v_variants == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 539, __pyx_L1_error)
        }
        __pyx_t_14 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
        for (;;) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_20 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_20); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 539, __pyx_L1_error)
          #else
          __pyx_t_20 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_20);
          __pyx_t_20 = 0;
          if (unlikely(__pyx_v_vcfInfo == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 539, __pyx_L1_error)
          }
          __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_vcfInfo, __pyx_v_v); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_19 = __Pyx_PyObject_Dict_GetItem(__pyx_t_20, __pyx_n_s_nReadsPerSample); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = __Pyx_GetItemInt(__pyx_t_19, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_20))) __PYX_ERR(0, 539, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF_SET(__pyx_v_readsPerSample, ((PyObject*)__pyx_t_15));
        __pyx_t_15 = 0;

        /* "vcfutils.pyx":540
 * 
 *                 readsPerSample = [vcfInfo[v]['nReadsPerSample'][i] for v in variants]
 *                 varReadsPerSample = [vcfInfo[v]['nVarReadsPerSample'][i] for v in variants]             # <<<<<<<<<<<<<<
 * 
 *                 #vcfDataLine[thisSample] = dict(GT=[GT], GL=normalisedGLs, GQ=[phredPosterior], GOF=[min(99,int(0.5 + -10.0*log10(max(1e-10, 1.0 - round(gofValue,2)))))],NR=readsPerSample, NV=varReadsPerSample)
 */
        __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 540, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (unlikely(__pyx_v_variants == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 540, __pyx_L1_error)
        }
        __pyx_t_14 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_14); __pyx_t_7 = 0;
        for (;;) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_14)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_20 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_7); __Pyx_INCREF(__pyx_t_20); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 540, __pyx_L1_error)
          #else
          __pyx_t_20 = PySequence_ITEM(__pyx_t_14, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 540, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_20);
          __pyx_t_20 = 0;
          if (unlikely(__pyx_v_vcfInfo == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 540, __pyx_L1_error)
          }
          __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_vcfInfo, __pyx_v_v); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 540, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_19 = __Pyx_PyObject_Dict_GetItem(__pyx_t_20, __pyx_n_s_nVarReadsPerSample); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 540, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = __Pyx_GetItemInt(__pyx_t_19, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 540, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_20))) __PYX_ERR(0, 540, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF_SET(__pyx_v_varReadsPerSample, ((PyObject*)__pyx_t_15));
        __pyx_t_15 = 0;

        /* "vcfutils.pyx":545
 * 
 *                 # Actual nReads covering variant locus
 *                 if nVariants == 1 and readsPerSample[0] < options.minReads:             # <<<<<<<<<<<<<<
 *                     vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=normalisedGLs, GQ=[phredPosterior],GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 *                 else:
 */
        __pyx_t_12 = ((__pyx_v_nVariants == 1) != 0);
        if (__pyx_t_12) {
        } else {
          __pyx_t_11 = __pyx_t_12;
          goto __pyx_L55_bool_binop_done;
        }
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minReads); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_14 = PyObject_RichCompare(PyList_GET_ITEM(__pyx_v_readsPerSample, 0), __pyx_t_15, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_11 = __pyx_t_12;
        __pyx_L55_bool_binop_done:;
        if (__pyx_t_11) {

          /* "vcfutils.pyx":546
 *                 # Actual nReads covering variant locus
 *                 if nVariants == 1 and readsPerSample[0] < options.minReads:
 *                     vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=normalisedGLs, GQ=[phredPosterior],GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)             # <<<<<<<<<<<<<<
 *                 else:
 *                     vcfDataLine[thisSample] = dict(GT=[GT], GL=normalisedGLs, GQ=[phredPosterior], GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 */
          __pyx_t_14 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_kp_s__2);
          __Pyx_GIVEREF(__pyx_kp_s__2);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_kp_s__2);
          __Pyx_INCREF(__pyx_kp_s__3);
          __Pyx_GIVEREF(__pyx_kp_s__3);
          PyList_SET_ITEM(__pyx_t_15, 1, __pyx_kp_s__3);
          __Pyx_INCREF(__pyx_kp_s__2);
          __Pyx_GIVEREF(__pyx_kp_s__2);
          PyList_SET_ITEM(__pyx_t_15, 2, __pyx_kp_s__2);
          __pyx_t_20 = PyList_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_GIVEREF(__pyx_t_15);
          PyList_SET_ITEM(__pyx_t_20, 0, __pyx_t_15);
          __pyx_t_15 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GT, __pyx_t_20) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GL, __pyx_v_normalisedGLs) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          __pyx_t_20 = PyList_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_INCREF(__pyx_v_phredPosterior);
          __Pyx_GIVEREF(__pyx_v_phredPosterior);
          PyList_SET_ITEM(__pyx_t_20, 0, __pyx_v_phredPosterior);
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GQ, __pyx_t_20) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = __Pyx_PyInt_FromDouble(__pyx_v_gofValue); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_20);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_20);
          __pyx_t_20 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GOF, __pyx_t_15) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_NR, __pyx_v_readsPerSample) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_NV, __pyx_v_varReadsPerSample) < 0) __PYX_ERR(0, 546, __pyx_L1_error)
          if (unlikely(PyDict_SetItem(__pyx_v_vcfDataLine, __pyx_v_thisSample, __pyx_t_14) < 0)) __PYX_ERR(0, 546, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "vcfutils.pyx":545
 * 
 *                 # Actual nReads covering variant locus
 *                 if nVariants == 1 and readsPerSample[0] < options.minReads:             # <<<<<<<<<<<<<<
 *                     vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=normalisedGLs, GQ=[phredPosterior],GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 *                 else:
 */
          goto __pyx_L54;
        }

        /* "vcfutils.pyx":548
 *                     vcfDataLine[thisSample] = dict(GT=[[".", "/", "."]], GL=normalisedGLs, GQ=[phredPosterior],GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 *                 else:
 *                     vcfDataLine[thisSample] = dict(GT=[GT], GL=normalisedGLs, GQ=[phredPosterior], GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)             # <<<<<<<<<<<<<<
 * 
 *                 if gofValue > maxGofValue:
 */
        /*else*/ {
          __pyx_t_14 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_v_GT);
          __Pyx_GIVEREF(__pyx_v_GT);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_GT);
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GT, __pyx_t_15) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GL, __pyx_v_normalisedGLs) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_v_phredPosterior);
          __Pyx_GIVEREF(__pyx_v_phredPosterior);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_v_phredPosterior);
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GQ, __pyx_t_15) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_PyInt_FromDouble(__pyx_v_gofValue); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_20 = PyList_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_GIVEREF(__pyx_t_15);
          PyList_SET_ITEM(__pyx_t_20, 0, __pyx_t_15);
          __pyx_t_15 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_GOF, __pyx_t_20) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_NR, __pyx_v_readsPerSample) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_NV, __pyx_v_varReadsPerSample) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
          if (unlikely(PyDict_SetItem(__pyx_v_vcfDataLine, __pyx_v_thisSample, __pyx_t_14) < 0)) __PYX_ERR(0, 548, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __pyx_L54:;

        /* "vcfutils.pyx":550
 *                     vcfDataLine[thisSample] = dict(GT=[GT], GL=normalisedGLs, GQ=[phredPosterior], GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 * 
 *                 if gofValue > maxGofValue:             # <<<<<<<<<<<<<<
 *                     maxGofValue = gofValue
 * 
 */
        __pyx_t_11 = ((__pyx_v_gofValue > __pyx_v_maxGofValue) != 0);
        if (__pyx_t_11) {

          /* "vcfutils.pyx":551
 * 
 *                 if gofValue > maxGofValue:
 *                     maxGofValue = gofValue             # <<<<<<<<<<<<<<
 * 
 *                 if gofValue < minGofValue:
 */
          __pyx_v_maxGofValue = __pyx_v_gofValue;

          /* "vcfutils.pyx":550
 *                     vcfDataLine[thisSample] = dict(GT=[GT], GL=normalisedGLs, GQ=[phredPosterior], GOF=[int(gofValue)],NR=readsPerSample, NV=varReadsPerSample)
 * 
 *                 if gofValue > maxGofValue:             # <<<<<<<<<<<<<<
 *                     maxGofValue = gofValue
 * 
 */
        }

        /* "vcfutils.pyx":553
 *                     maxGofValue = gofValue
 * 
 *                 if gofValue < minGofValue:             # <<<<<<<<<<<<<<
 *                     minGofValue = gofValue
 * 
 */
        __pyx_t_11 = ((__pyx_v_gofValue < __pyx_v_minGofValue) != 0);
        if (__pyx_t_11) {

          /* "vcfutils.pyx":554
 * 
 *                 if gofValue < minGofValue:
 *                     minGofValue = gofValue             # <<<<<<<<<<<<<<
 * 
 *         # These are just temporary values. Don't output them
 */
          __pyx_v_minGofValue = __pyx_v_gofValue;

          /* "vcfutils.pyx":553
 *                     maxGofValue = gofValue
 * 
 *                 if gofValue < minGofValue:             # <<<<<<<<<<<<<<
 *                     minGofValue = gofValue
 * 
 */
        }
      }
      __pyx_L31_continue:;
    }

    /* "vcfutils.pyx":557
 * 
 *         # These are just temporary values. Don't output them
 *         vcfDataLine['info'].pop('nReadsPerSample')             # <<<<<<<<<<<<<<
 *         vcfDataLine['info'].pop('nVarReadsPerSample')
 *         vcfDataLine['info'].pop('ABPV')
 */
    __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_info); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_pop); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_20)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    __pyx_t_14 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_20, __pyx_n_s_nReadsPerSample) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_n_s_nReadsPerSample);
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "vcfutils.pyx":558
 *         # These are just temporary values. Don't output them
 *         vcfDataLine['info'].pop('nReadsPerSample')
 *         vcfDataLine['info'].pop('nVarReadsPerSample')             # <<<<<<<<<<<<<<
 *         vcfDataLine['info'].pop('ABPV')
 *         vcfDataLine['info']['MGOF'] = [int(round(maxGofValue, 2))]
 */
    __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_info); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_pop); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_20);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_20, function);
      }
    }
    __pyx_t_14 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_15, __pyx_n_s_nVarReadsPerSample) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_n_s_nVarReadsPerSample);
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "vcfutils.pyx":559
 *         vcfDataLine['info'].pop('nReadsPerSample')
 *         vcfDataLine['info'].pop('nVarReadsPerSample')
 *         vcfDataLine['info'].pop('ABPV')             # <<<<<<<<<<<<<<
 *         vcfDataLine['info']['MGOF'] = [int(round(maxGofValue, 2))]
 * 
 */
    __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_info); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_pop); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_20)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    __pyx_t_14 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_20, __pyx_n_s_ABPV) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_n_s_ABPV);
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "vcfutils.pyx":560
 *         vcfDataLine['info'].pop('nVarReadsPerSample')
 *         vcfDataLine['info'].pop('ABPV')
 *         vcfDataLine['info']['MGOF'] = [int(round(maxGofValue, 2))]             # <<<<<<<<<<<<<<
 * 
 *         gofsThisPos.sort()
 */
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_maxGofValue); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_int_2);
    __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_15, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyNumber_Int(__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyList_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
    __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_info); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (unlikely(PyObject_SetItem(__pyx_t_15, __pyx_n_s_MGOF, __pyx_t_14) < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "vcfutils.pyx":562
 *         vcfDataLine['info']['MGOF'] = [int(round(maxGofValue, 2))]
 * 
 *         gofsThisPos.sort()             # <<<<<<<<<<<<<<
 * 
 *         #if minGofValue > gofThreshold:
 */
    __pyx_t_5 = PyList_Sort(__pyx_v_gofsThisPos); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 562, __pyx_L1_error)

    /* "vcfutils.pyx":571
 * 
 *         # Write variant call info to VCF file.
 *         if nNonRefCalls > 0 or options.minPosterior == 0 or options.outputRefCalls == 1:             # <<<<<<<<<<<<<<
 * 
 *             # Slight hack. We pad variant alleles to the left with reference sequence, when
 */
    __pyx_t_14 = PyObject_RichCompare(__pyx_v_nNonRefCalls, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 571, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (!__pyx_t_12) {
    } else {
      __pyx_t_11 = __pyx_t_12;
      goto __pyx_L60_bool_binop_done;
    }
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minPosterior); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = __Pyx_PyInt_EqObjC(__pyx_t_14, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!__pyx_t_12) {
    } else {
      __pyx_t_11 = __pyx_t_12;
      goto __pyx_L60_bool_binop_done;
    }
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_outputRefCalls); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = __Pyx_PyInt_EqObjC(__pyx_t_15, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_11 = __pyx_t_12;
    __pyx_L60_bool_binop_done:;
    if (__pyx_t_11) {

      /* "vcfutils.pyx":579
 *             # left should be un-padded.
 *             #logger.info("Variants = %s" %(variants))
 *             trimLeftPadding(vcfDataLine)             # <<<<<<<<<<<<<<
 * 
 *             # Don't output if the reference bases are non-canonical
 */
      __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_trimLeftPadding); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_20 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      __pyx_t_14 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_20, __pyx_v_vcfDataLine) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_v_vcfDataLine);
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "vcfutils.pyx":582
 * 
 *             # Don't output if the reference bases are non-canonical
 *             for c in vcfDataLine['ref']:             # <<<<<<<<<<<<<<
 * 
 *                 if c not in canonicalBases:
 */
      __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_ref); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) {
        __pyx_t_15 = __pyx_t_14; __Pyx_INCREF(__pyx_t_15); __pyx_t_7 = 0;
        __pyx_t_18 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_18 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 582, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      for (;;) {
        if (likely(!__pyx_t_18)) {
          if (likely(PyList_CheckExact(__pyx_t_15))) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_15)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_7); __Pyx_INCREF(__pyx_t_14); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 582, __pyx_L1_error)
            #else
            __pyx_t_14 = PySequence_ITEM(__pyx_t_15, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 582, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
          } else {
            if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_7); __Pyx_INCREF(__pyx_t_14); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 582, __pyx_L1_error)
            #else
            __pyx_t_14 = PySequence_ITEM(__pyx_t_15, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 582, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
          }
        } else {
          __pyx_t_14 = __pyx_t_18(__pyx_t_15);
          if (unlikely(!__pyx_t_14)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 582, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_14);
        }
        __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_14);
        __pyx_t_14 = 0;

        /* "vcfutils.pyx":584
 *             for c in vcfDataLine['ref']:
 * 
 *                 if c not in canonicalBases:             # <<<<<<<<<<<<<<
 *                     theChrom = vcfDataLine['chrom']
 *                     thePos = vcfDataLine['pos']
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_canonicalBases); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_c, __pyx_t_14, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 584, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_12 = (__pyx_t_11 != 0);
        if (__pyx_t_12) {

          /* "vcfutils.pyx":585
 * 
 *                 if c not in canonicalBases:
 *                     theChrom = vcfDataLine['chrom']             # <<<<<<<<<<<<<<
 *                     thePos = vcfDataLine['pos']
 *                     theRef = vcfDataLine['ref']
 */
          __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_chrom); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 585, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_theChrom, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":586
 *                 if c not in canonicalBases:
 *                     theChrom = vcfDataLine['chrom']
 *                     thePos = vcfDataLine['pos']             # <<<<<<<<<<<<<<
 *                     theRef = vcfDataLine['ref']
 *                     theAlt = vcfDataLine['alt']
 */
          __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_pos); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 586, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_thePos, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":587
 *                     theChrom = vcfDataLine['chrom']
 *                     thePos = vcfDataLine['pos']
 *                     theRef = vcfDataLine['ref']             # <<<<<<<<<<<<<<
 *                     theAlt = vcfDataLine['alt']
 *                     logger.warning("Skipping output for call %s:%s %s --> %s, as the reference sequence contains non-canonical bases (i.e. not A,C,T,G)" %(theChrom,thePos,theRef,theAlt))
 */
          __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_ref); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 587, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_theRef, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":588
 *                     thePos = vcfDataLine['pos']
 *                     theRef = vcfDataLine['ref']
 *                     theAlt = vcfDataLine['alt']             # <<<<<<<<<<<<<<
 *                     logger.warning("Skipping output for call %s:%s %s --> %s, as the reference sequence contains non-canonical bases (i.e. not A,C,T,G)" %(theChrom,thePos,theRef,theAlt))
 *                     break
 */
          __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_alt); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 588, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_XDECREF_SET(__pyx_v_theAlt, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "vcfutils.pyx":589
 *                     theRef = vcfDataLine['ref']
 *                     theAlt = vcfDataLine['alt']
 *                     logger.warning("Skipping output for call %s:%s %s --> %s, as the reference sequence contains non-canonical bases (i.e. not A,C,T,G)" %(theChrom,thePos,theRef,theAlt))             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_logger); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_warning); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = PyTuple_New(4); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_INCREF(__pyx_v_theChrom);
          __Pyx_GIVEREF(__pyx_v_theChrom);
          PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_v_theChrom);
          __Pyx_INCREF(__pyx_v_thePos);
          __Pyx_GIVEREF(__pyx_v_thePos);
          PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_v_thePos);
          __Pyx_INCREF(__pyx_v_theRef);
          __Pyx_GIVEREF(__pyx_v_theRef);
          PyTuple_SET_ITEM(__pyx_t_20, 2, __pyx_v_theRef);
          __Pyx_INCREF(__pyx_v_theAlt);
          __Pyx_GIVEREF(__pyx_v_theAlt);
          PyTuple_SET_ITEM(__pyx_t_20, 3, __pyx_v_theAlt);
          __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_Skipping_output_for_call_s_s_s_s, __pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __pyx_t_20 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
            __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
            if (likely(__pyx_t_20)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
              __Pyx_INCREF(__pyx_t_20);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_19, function);
            }
          }
          __pyx_t_14 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_20, __pyx_t_16) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_16);
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "vcfutils.pyx":590
 *                     theAlt = vcfDataLine['alt']
 *                     logger.warning("Skipping output for call %s:%s %s --> %s, as the reference sequence contains non-canonical bases (i.e. not A,C,T,G)" %(theChrom,thePos,theRef,theAlt))
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 outputSingleLineOfVCF(vcfDataLine, outputFile, vcfFile, options)
 */
          goto __pyx_L64_break;

          /* "vcfutils.pyx":584
 *             for c in vcfDataLine['ref']:
 * 
 *                 if c not in canonicalBases:             # <<<<<<<<<<<<<<
 *                     theChrom = vcfDataLine['chrom']
 *                     thePos = vcfDataLine['pos']
 */
        }

        /* "vcfutils.pyx":582
 * 
 *             # Don't output if the reference bases are non-canonical
 *             for c in vcfDataLine['ref']:             # <<<<<<<<<<<<<<
 * 
 *                 if c not in canonicalBases:
 */
      }
      /*else*/ {

        /* "vcfutils.pyx":592
 *                     break
 *             else:
 *                 outputSingleLineOfVCF(vcfDataLine, outputFile, vcfFile, options)             # <<<<<<<<<<<<<<
 * 
 *     # Free memory. (TODO: move this somewhere else).
 */
        __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_outputSingleLineOfVCF); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_16 = NULL;
        __pyx_t_2 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_19);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_19, function);
            __pyx_t_2 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_19)) {
          PyObject *__pyx_temp[5] = {__pyx_t_16, __pyx_v_vcfDataLine, __pyx_v_outputFile, __pyx_v_vcfFile, __pyx_v_options};
          __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_2, 4+__pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
          PyObject *__pyx_temp[5] = {__pyx_t_16, __pyx_v_vcfDataLine, __pyx_v_outputFile, __pyx_v_vcfFile, __pyx_v_options};
          __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_2, 4+__pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        {
          __pyx_t_20 = PyTuple_New(4+__pyx_t_2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          if (__pyx_t_16) {
            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_16); __pyx_t_16 = NULL;
          }
          __Pyx_INCREF(__pyx_v_vcfDataLine);
          __Pyx_GIVEREF(__pyx_v_vcfDataLine);
          PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_2, __pyx_v_vcfDataLine);
          __Pyx_INCREF(__pyx_v_outputFile);
          __Pyx_GIVEREF(__pyx_v_outputFile);
          PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_2, __pyx_v_outputFile);
          __Pyx_INCREF(__pyx_v_vcfFile);
          __Pyx_GIVEREF(__pyx_v_vcfFile);
          PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_2, __pyx_v_vcfFile);
          __Pyx_INCREF(__pyx_v_options);
          __Pyx_GIVEREF(__pyx_v_options);
          PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_2, __pyx_v_options);
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_20, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        }
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }

      /* "vcfutils.pyx":582
 * 
 *             # Don't output if the reference bases are non-canonical
 *             for c in vcfDataLine['ref']:             # <<<<<<<<<<<<<<
 * 
 *                 if c not in canonicalBases:
 */
      __pyx_L64_break:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

      /* "vcfutils.pyx":571
 * 
 *         # Write variant call info to VCF file.
 *         if nNonRefCalls > 0 or options.minPosterior == 0 or options.outputRefCalls == 1:             # <<<<<<<<<<<<<<
 * 
 *             # Slight hack. We pad variant alleles to the left with reference sequence, when
 */
    }

    /* "vcfutils.pyx":398
 *         varThisPosInHap[hapIndex] = <int*>(calloc(len(allVariants), sizeof(int)))
 * 
 *     for POS in sortedPositions:             # <<<<<<<<<<<<<<
 * 
 *         #logger.info("Variants at position %s = %s" %(POS, varsByPos[POS]))
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":595
 * 
 *     # Free memory. (TODO: move this somewhere else).
 *     for hapIndex in range(len(haplotypes)):             # <<<<<<<<<<<<<<
 *         free(varThisPosInHap[hapIndex])
 * 
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 595, __pyx_L1_error)
  }
  __pyx_t_6 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 595, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_6;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_7; __pyx_t_2+=1) {
    __pyx_v_hapIndex = __pyx_t_2;

    /* "vcfutils.pyx":596
 *     # Free memory. (TODO: move this somewhere else).
 *     for hapIndex in range(len(haplotypes)):
 *         free(varThisPosInHap[hapIndex])             # <<<<<<<<<<<<<<
 * 
 *     free(varThisPosInHap)
 */
    free((__pyx_v_varThisPosInHap[__pyx_v_hapIndex]));
  }

  /* "vcfutils.pyx":598
 *         free(varThisPosInHap[hapIndex])
 * 
 *     free(varThisPosInHap)             # <<<<<<<<<<<<<<
 *     free(haplotypeIsRefAtThisPos)
 * 
 */
  free(__pyx_v_varThisPosInHap);

  /* "vcfutils.pyx":599
 * 
 *     free(varThisPosInHap)
 *     free(haplotypeIsRefAtThisPos)             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  free(__pyx_v_haplotypeIsRefAtThisPos);

  /* "vcfutils.pyx":338
 * ###################################################################################################
 * 
 * cdef void outputCallToVCF(dict varsByPos, dict vcfInfo, dict vcfFilter, list haplotypes, list genotypes, double* haplotypeFrequencies, double** genotypeLikelihoods, double** gofValues, int** haplotypeIndexes, list readBuffers, int nIndividuals, vcfFile, FastaFile refFile, outputFile, options, list allVariants, int windowStart, int windowEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Output a call to a vcf file. Uses the signature of the callingModule.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_WriteUnraisable("vcfutils.outputCallToVCF", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_haplotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_theBuffer);
  __Pyx_XDECREF(__pyx_v_info);
  __Pyx_XDECREF(__pyx_v_lineinfo);
  __Pyx_XDECREF(__pyx_v_normalisedGLs);
  __Pyx_XDECREF(__pyx_v_FR);
  __Pyx_XDECREF(__pyx_v_PP);
  __Pyx_XDECREF(__pyx_v_NF);
  __Pyx_XDECREF(__pyx_v_NR);
  __Pyx_XDECREF(__pyx_v_TR);
  __Pyx_XDECREF(__pyx_v_GT);
  __Pyx_XDECREF(__pyx_v_linefilter);
  __Pyx_XDECREF(__pyx_v_thisSample);
  __Pyx_XDECREF(__pyx_v_sortedPositions);
  __Pyx_XDECREF(__pyx_v_variants);
  __Pyx_XDECREF(__pyx_v_likelihoods);
  __Pyx_XDECREF(__pyx_v_variantsThisPos);
  __Pyx_XDECREF(__pyx_v_POS);
  __Pyx_XDECREF(__pyx_v_variant);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_alt);
  __Pyx_XDECREF(__pyx_v_theId);
  __Pyx_XDECREF(__pyx_v_qual);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XDECREF(__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_freq);
  __Pyx_XDECREF(__pyx_v_posterior);
  __Pyx_XDECREF(__pyx_v_varTR);
  __Pyx_XDECREF(__pyx_v_varNF);
  __Pyx_XDECREF(__pyx_v_varNR);
  __Pyx_XDECREF(__pyx_v_vcfDataLine);
  __Pyx_XDECREF(__pyx_v_theVar);
  __Pyx_XDECREF(__pyx_v_gofsThisPos);
  __Pyx_XDECREF(__pyx_v_nNonRefCalls);
  __Pyx_XDECREF(__pyx_v_phredPosterior);
  __Pyx_XDECREF(__pyx_v_phredNonRefPosterior);
  __Pyx_XDECREF(__pyx_v_phredRefPosterior);
  __Pyx_XDECREF(__pyx_v_readsPerSample);
  __Pyx_XDECREF(__pyx_v_varReadsPerSample);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_theChrom);
  __Pyx_XDECREF(__pyx_v_thePos);
  __Pyx_XDECREF(__pyx_v_theRef);
  __Pyx_XDECREF(__pyx_v_theAlt);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_pp);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_RefNannyFinishContext();
}

/* "vcfutils.pyx":602
 * 
 * ###################################################################################################
 * cdef void outputHLACallToVCF(list haplotypes, list readBuffers, int nIndividuals, FastaFile refFile, outputFile, options, int windowStart, int windowEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Output a call to a vcf file. Uses the signature of the callingModule.
 */

static void __pyx_f_8vcfutils_outputHLACallToVCF(PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_readBuffers, int __pyx_v_nIndividuals, CYTHON_UNUSED struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile, PyObject *__pyx_v_outputFile, PyObject *__pyx_v_options, int __pyx_v_windowStart, int __pyx_v_windowEnd) {
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_haplotype = 0;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_theBuffer = 0;
  CYTHON_UNUSED PyObject *__pyx_v_thisSample = 0;
  struct __pyx_obj_7variant_Variant *__pyx_v_longVar = 0;
  PyObject *__pyx_v_chrom = NULL;
  PyObject *__pyx_v_alts = NULL;
  int __pyx_v_index;
  PyObject *__pyx_v_indexOfBestGenotype = 0;
  double __pyx_v_likelihoodThisGenotype;
  double __pyx_v_maxEMLikelihood;
  struct __pyx_obj_9cgenotype_DiploidGenotype *__pyx_v_gt = 0;
  int __pyx_v_nHaplotypes;
  int __pyx_v_hapIndex1;
  int __pyx_v_hapIndex2;
  PyObject *__pyx_v_genotypeCalls = 0;
  int __pyx_v_nReads;
  PyObject *__pyx_v_allGTs = 0;
  PyObject *__pyx_v_thisGTs = 0;
  PyObject *__pyx_v_GLs = 0;
  PyObject *__pyx_v_NRs = 0;
  PyObject *__pyx_v_NV1s = 0;
  PyObject *__pyx_v_NV2s = 0;
  PyObject *__pyx_v_CFs = 0;
  PyObject *__pyx_v_secondMaxCandidates = 0;
  double __pyx_v_secondMaxLikelihood;
  int __pyx_v_nv1;
  int __pyx_v_nv2;
  int __pyx_v_readIndex;
  CYTHON_UNUSED int __pyx_v_totalReads;
  int __pyx_v_nBadReads;
  int __pyx_v_nBrokenPairReads;
  double *__pyx_v_alignScoreArr1;
  double *__pyx_v_alignScoreArr2;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap1 = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap2 = 0;
  PyObject *__pyx_v_thisNV1 = 0;
  PyObject *__pyx_v_thisNV2 = 0;
  double *__pyx_v_gof;
  CYTHON_UNUSED double *__pyx_v_arr;
  PyObject *__pyx_v_varSource = NULL;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_fo = NULL;
  PyObject *__pyx_v_thisStr = NULL;
  PyObject *__pyx_v_LKs = NULL;
  PyObject *__pyx_v_tempIndex = NULL;
  Py_ssize_t __pyx_v_tempIdx;
  PyObject *__pyx_v_gtIndex = NULL;
  char *__pyx_v_alt1;
  char *__pyx_v_alt2;
  PyObject *__pyx_v_altIndex1 = NULL;
  PyObject *__pyx_v_altIndex2 = NULL;
  double __pyx_v_score1;
  double __pyx_v_score2;
  double __pyx_v_confidenceScore;
  PyObject *__pyx_v_theId = NULL;
  PyObject *__pyx_v_qual = NULL;
  PyObject *__pyx_v_format = NULL;
  PyObject *__pyx_v_linefilter = NULL;
  PyObject *__pyx_v_infoLine = NULL;
  PyObject *__pyx_v_theLine = NULL;
  long __pyx_v_i;
  PyObject *__pyx_v_sampleLine = NULL;
  PyObject *__pyx_v_cf = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  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_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  double __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  char *__pyx_t_20;
  char *__pyx_t_21;
  __Pyx_RefNannySetupContext("outputHLACallToVCF", 0);

  /* "vcfutils.pyx":617
 *     cdef bytes thisSample
 *     cdef Variant longVar
 *     haplotype = haplotypes[0]             # <<<<<<<<<<<<<<
 *     longVar = haplotype.longVar
 * 
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 617, __pyx_L1_error)
  }
  if (!(likely(((PyList_GET_ITEM(__pyx_v_haplotypes, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_haplotypes, 0), __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 617, __pyx_L1_error)
  __pyx_t_1 = PyList_GET_ITEM(__pyx_v_haplotypes, 0);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_haplotype = ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":618
 *     cdef Variant longVar
 *     haplotype = haplotypes[0]
 *     longVar = haplotype.longVar             # <<<<<<<<<<<<<<
 * 
 *     chrom = longVar.refName
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_haplotype->longVar);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_longVar = ((struct __pyx_obj_7variant_Variant *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":620
 *     longVar = haplotype.longVar
 * 
 *     chrom = longVar.refName             # <<<<<<<<<<<<<<
 * 
 *     alts = []
 */
  __pyx_t_1 = __pyx_v_longVar->refName;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_chrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":622
 *     chrom = longVar.refName
 * 
 *     alts = []             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_alts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":625
 * 
 *     cdef:
 *         int index = 0             # <<<<<<<<<<<<<<
 *         list indexOfBestGenotype=[]
 *         double likelihoodThisGenotype =0.0
 */
  __pyx_v_index = 0;

  /* "vcfutils.pyx":626
 *     cdef:
 *         int index = 0
 *         list indexOfBestGenotype=[]             # <<<<<<<<<<<<<<
 *         double likelihoodThisGenotype =0.0
 *         double maxEMLikelihood = 0.0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_indexOfBestGenotype = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":627
 *         int index = 0
 *         list indexOfBestGenotype=[]
 *         double likelihoodThisGenotype =0.0             # <<<<<<<<<<<<<<
 *         double maxEMLikelihood = 0.0
 *         DiploidGenotype gt
 */
  __pyx_v_likelihoodThisGenotype = 0.0;

  /* "vcfutils.pyx":628
 *         list indexOfBestGenotype=[]
 *         double likelihoodThisGenotype =0.0
 *         double maxEMLikelihood = 0.0             # <<<<<<<<<<<<<<
 *         DiploidGenotype gt
 *         int nHaplotypes = len(haplotypes)
 */
  __pyx_v_maxEMLikelihood = 0.0;

  /* "vcfutils.pyx":630
 *         double maxEMLikelihood = 0.0
 *         DiploidGenotype gt
 *         int nHaplotypes = len(haplotypes)             # <<<<<<<<<<<<<<
 *         list gtIdx
 *         int hapIndex1, hapIndex2
 */
  if (unlikely(__pyx_v_haplotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 630, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 630, __pyx_L1_error)
  __pyx_v_nHaplotypes = __pyx_t_2;

  /* "vcfutils.pyx":634
 *         int hapIndex1, hapIndex2
 * 
 *         list genotypeCalls = [] # Genotype data type genotype calls of all individuals, stored by index in the "genotypes"  list             # <<<<<<<<<<<<<<
 *         int nReads =0
 *         list allGTs =[]   # all genotypes of individuals, indexing  by the order of alts,
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_genotypeCalls = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":635
 * 
 *         list genotypeCalls = [] # Genotype data type genotype calls of all individuals, stored by index in the "genotypes"  list
 *         int nReads =0             # <<<<<<<<<<<<<<
 *         list allGTs =[]   # all genotypes of individuals, indexing  by the order of alts,
 *         list thisGTs = [] # genotype this individual, indexing by the order in the alts list
 */
  __pyx_v_nReads = 0;

  /* "vcfutils.pyx":636
 *         list genotypeCalls = [] # Genotype data type genotype calls of all individuals, stored by index in the "genotypes"  list
 *         int nReads =0
 *         list allGTs =[]   # all genotypes of individuals, indexing  by the order of alts,             # <<<<<<<<<<<<<<
 *         list thisGTs = [] # genotype this individual, indexing by the order in the alts list
 *         list GLs = []     # genotype likelihood of the called genotype
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_allGTs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":637
 *         int nReads =0
 *         list allGTs =[]   # all genotypes of individuals, indexing  by the order of alts,
 *         list thisGTs = [] # genotype this individual, indexing by the order in the alts list             # <<<<<<<<<<<<<<
 *         list GLs = []     # genotype likelihood of the called genotype
 *         list NRs = []     # number of reads supporting first haplotype
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_thisGTs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":638
 *         list allGTs =[]   # all genotypes of individuals, indexing  by the order of alts,
 *         list thisGTs = [] # genotype this individual, indexing by the order in the alts list
 *         list GLs = []     # genotype likelihood of the called genotype             # <<<<<<<<<<<<<<
 *         list NRs = []     # number of reads supporting first haplotype
 *         list NV1s = []     # number of reads supporting
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_GLs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":639
 *         list thisGTs = [] # genotype this individual, indexing by the order in the alts list
 *         list GLs = []     # genotype likelihood of the called genotype
 *         list NRs = []     # number of reads supporting first haplotype             # <<<<<<<<<<<<<<
 *         list NV1s = []     # number of reads supporting
 *         list NV2s = []     # number of reads supporting
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_NRs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":640
 *         list GLs = []     # genotype likelihood of the called genotype
 *         list NRs = []     # number of reads supporting first haplotype
 *         list NV1s = []     # number of reads supporting             # <<<<<<<<<<<<<<
 *         list NV2s = []     # number of reads supporting
 *         list CFs = []     # confidence score = (maximumLikelihood - secondMaximumLikelihood) / haplotypeLen
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_NV1s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":641
 *         list NRs = []     # number of reads supporting first haplotype
 *         list NV1s = []     # number of reads supporting
 *         list NV2s = []     # number of reads supporting             # <<<<<<<<<<<<<<
 *         list CFs = []     # confidence score = (maximumLikelihood - secondMaximumLikelihood) / haplotypeLen
 *         list secondMaxCandidates = []
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_NV2s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":642
 *         list NV1s = []     # number of reads supporting
 *         list NV2s = []     # number of reads supporting
 *         list CFs = []     # confidence score = (maximumLikelihood - secondMaximumLikelihood) / haplotypeLen             # <<<<<<<<<<<<<<
 *         list secondMaxCandidates = []
 *         double secondMaxLikelihood = 0.0
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_CFs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":643
 *         list NV2s = []     # number of reads supporting
 *         list CFs = []     # confidence score = (maximumLikelihood - secondMaximumLikelihood) / haplotypeLen
 *         list secondMaxCandidates = []             # <<<<<<<<<<<<<<
 *         double secondMaxLikelihood = 0.0
 *         int nv1, nv2, readIndex, totalReads, nBadReads, nBrokenPairReads
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_secondMaxCandidates = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":644
 *         list CFs = []     # confidence score = (maximumLikelihood - secondMaximumLikelihood) / haplotypeLen
 *         list secondMaxCandidates = []
 *         double secondMaxLikelihood = 0.0             # <<<<<<<<<<<<<<
 *         int nv1, nv2, readIndex, totalReads, nBadReads, nBrokenPairReads
 *         double* alignScoreArr1 = NULL
 */
  __pyx_v_secondMaxLikelihood = 0.0;

  /* "vcfutils.pyx":646
 *         double secondMaxLikelihood = 0.0
 *         int nv1, nv2, readIndex, totalReads, nBadReads, nBrokenPairReads
 *         double* alignScoreArr1 = NULL             # <<<<<<<<<<<<<<
 *         double* alignScoreArr2 = NULL
 *         cAlignedRead* thisRead
 */
  __pyx_v_alignScoreArr1 = NULL;

  /* "vcfutils.pyx":647
 *         int nv1, nv2, readIndex, totalReads, nBadReads, nBrokenPairReads
 *         double* alignScoreArr1 = NULL
 *         double* alignScoreArr2 = NULL             # <<<<<<<<<<<<<<
 *         cAlignedRead* thisRead
 *         cdef Haplotype hap1, hap2
 */
  __pyx_v_alignScoreArr2 = NULL;

  /* "vcfutils.pyx":652
 *         list thisNV1, thisNV2
 *         double like1, like2, likelihood
 *         double* gof = <double*>(calloc(nIndividuals+10, sizeof(double)))             # <<<<<<<<<<<<<<
 *         double* arr = NULL
 * 
 */
  __pyx_v_gof = ((double *)calloc((__pyx_v_nIndividuals + 10), (sizeof(double))));

  /* "vcfutils.pyx":653
 *         double like1, like2, likelihood
 *         double* gof = <double*>(calloc(nIndividuals+10, sizeof(double)))
 *         double* arr = NULL             # <<<<<<<<<<<<<<
 * 
 *     varSource = set()
 */
  __pyx_v_arr = NULL;

  /* "vcfutils.pyx":655
 *         double* arr = NULL
 * 
 *     varSource = set()             # <<<<<<<<<<<<<<
 *     logger.debug("Start output to vcf")
 *     ref = ''
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_varSource = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":656
 * 
 *     varSource = set()
 *     logger.debug("Start output to vcf")             # <<<<<<<<<<<<<<
 *     ref = ''
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_kp_s_Start_output_to_vcf) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Start_output_to_vcf);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":657
 *     varSource = set()
 *     logger.debug("Start output to vcf")
 *     ref = ''             # <<<<<<<<<<<<<<
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))
 *     fo = None
 */
  __Pyx_INCREF(__pyx_kp_s__4);
  __pyx_v_ref = __pyx_kp_s__4;

  /* "vcfutils.pyx":658
 *     logger.debug("Start output to vcf")
 *     ref = ''
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))             # <<<<<<<<<<<<<<
 *     fo = None
 *     if options.alignScoreFile != "":
 */
  (void)(memset(__pyx_v_gof, 0, ((sizeof(double)) * (__pyx_v_nIndividuals + 3))));

  /* "vcfutils.pyx":659
 *     ref = ''
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))
 *     fo = None             # <<<<<<<<<<<<<<
 *     if options.alignScoreFile != "":
 *         fo = open(options.alignScoreFile, 'a')
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_fo = Py_None;

  /* "vcfutils.pyx":660
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))
 *     fo = None
 *     if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *         fo = open(options.alignScoreFile, 'a')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "vcfutils.pyx":661
 *     fo = None
 *     if options.alignScoreFile != "":
 *         fo = open(options.alignScoreFile, 'a')             # <<<<<<<<<<<<<<
 * 
 *     for index from 0<= index < nIndividuals:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_INCREF(__pyx_n_s_a);
    __Pyx_GIVEREF(__pyx_n_s_a);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_s_a);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_fo, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":660
 *     memset(gof, 0, sizeof(double)* (nIndividuals+3))
 *     fo = None
 *     if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *         fo = open(options.alignScoreFile, 'a')
 * 
 */
  }

  /* "vcfutils.pyx":663
 *         fo = open(options.alignScoreFile, 'a')
 * 
 *     for index from 0<= index < nIndividuals:             # <<<<<<<<<<<<<<
 *         theBuffer = readBuffers[index]
 *         nReads = theBuffer.reads.windowEnd - theBuffer.reads.windowStart
 */
  __pyx_t_6 = __pyx_v_nIndividuals;
  for (__pyx_v_index = 0; __pyx_v_index < __pyx_t_6; __pyx_v_index++) {

    /* "vcfutils.pyx":664
 * 
 *     for index from 0<= index < nIndividuals:
 *         theBuffer = readBuffers[index]             # <<<<<<<<<<<<<<
 *         nReads = theBuffer.reads.windowEnd - theBuffer.reads.windowStart
 *         nBadReads = theBuffer.badReads.windowEnd - theBuffer.badReads.windowStart
 */
    if (unlikely(__pyx_v_readBuffers == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 664, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 664, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":665
 *     for index from 0<= index < nIndividuals:
 *         theBuffer = readBuffers[index]
 *         nReads = theBuffer.reads.windowEnd - theBuffer.reads.windowStart             # <<<<<<<<<<<<<<
 *         nBadReads = theBuffer.badReads.windowEnd - theBuffer.badReads.windowStart
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart
 */
    __pyx_v_nReads = (__pyx_v_theBuffer->reads->windowEnd - __pyx_v_theBuffer->reads->windowStart);

    /* "vcfutils.pyx":666
 *         theBuffer = readBuffers[index]
 *         nReads = theBuffer.reads.windowEnd - theBuffer.reads.windowStart
 *         nBadReads = theBuffer.badReads.windowEnd - theBuffer.badReads.windowStart             # <<<<<<<<<<<<<<
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart
 *         totalReads = nReads + nBadReads + nBrokenPairReads
 */
    __pyx_v_nBadReads = (__pyx_v_theBuffer->badReads->windowEnd - __pyx_v_theBuffer->badReads->windowStart);

    /* "vcfutils.pyx":667
 *         nReads = theBuffer.reads.windowEnd - theBuffer.reads.windowStart
 *         nBadReads = theBuffer.badReads.windowEnd - theBuffer.badReads.windowStart
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart             # <<<<<<<<<<<<<<
 *         totalReads = nReads + nBadReads + nBrokenPairReads
 *         if options.alignScoreFile != "":
 */
    __pyx_v_nBrokenPairReads = (__pyx_v_theBuffer->brokenMates->windowEnd - __pyx_v_theBuffer->brokenMates->windowStart);

    /* "vcfutils.pyx":668
 *         nBadReads = theBuffer.badReads.windowEnd - theBuffer.badReads.windowStart
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart
 *         totalReads = nReads + nBadReads + nBrokenPairReads             # <<<<<<<<<<<<<<
 *         if options.alignScoreFile != "":
 *             fo.write("Individual\t%d\t%d\t%d:%d-%d\n" %(index, len(haplotypes), nReads,windowStart, windowEnd))
 */
    __pyx_v_totalReads = ((__pyx_v_nReads + __pyx_v_nBadReads) + __pyx_v_nBrokenPairReads);

    /* "vcfutils.pyx":669
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart
 *         totalReads = nReads + nBadReads + nBrokenPairReads
 *         if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             fo.write("Individual\t%d\t%d\t%d:%d-%d\n" %(index, len(haplotypes), nReads,windowStart, windowEnd))
 *         secondMaxCandidates = []
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "vcfutils.pyx":670
 *         totalReads = nReads + nBadReads + nBrokenPairReads
 *         if options.alignScoreFile != "":
 *             fo.write("Individual\t%d\t%d\t%d:%d-%d\n" %(index, len(haplotypes), nReads,windowStart, windowEnd))             # <<<<<<<<<<<<<<
 *         secondMaxCandidates = []
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
        __PYX_ERR(0, 670, __pyx_L1_error)
      }
      __pyx_t_2 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 670, __pyx_L1_error)
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_nReads); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_windowStart); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_10);
      __pyx_t_3 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Individual_d_d_d_d_d, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "vcfutils.pyx":669
 *         nBrokenPairReads = theBuffer.brokenMates.windowEnd - theBuffer.brokenMates.windowStart
 *         totalReads = nReads + nBadReads + nBrokenPairReads
 *         if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             fo.write("Individual\t%d\t%d\t%d:%d-%d\n" %(index, len(haplotypes), nReads,windowStart, windowEnd))
 *         secondMaxCandidates = []
 */
    }

    /* "vcfutils.pyx":671
 *         if options.alignScoreFile != "":
 *             fo.write("Individual\t%d\t%d\t%d:%d-%d\n" %(index, len(haplotypes), nReads,windowStart, windowEnd))
 *         secondMaxCandidates = []             # <<<<<<<<<<<<<<
 * 
 *         thisGTs = []
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_secondMaxCandidates, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":673
 *         secondMaxCandidates = []
 * 
 *         thisGTs = []             # <<<<<<<<<<<<<<
 *         NRs.append(nReads)
 *         thisNV1, thisNV2 = [], []
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_thisGTs, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":674
 * 
 *         thisGTs = []
 *         NRs.append(nReads)             # <<<<<<<<<<<<<<
 *         thisNV1, thisNV2 = [], []
 *         if nReads ==0:
 */
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nReads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_NRs, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 674, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "vcfutils.pyx":675
 *         thisGTs = []
 *         NRs.append(nReads)
 *         thisNV1, thisNV2 = [], []             # <<<<<<<<<<<<<<
 *         if nReads ==0:
 *             genotypeCalls.append([])
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_thisNV1, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_thisNV2, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":676
 *         NRs.append(nReads)
 *         thisNV1, thisNV2 = [], []
 *         if nReads ==0:             # <<<<<<<<<<<<<<
 *             genotypeCalls.append([])
 *             allGTs.append(thisGTs)
 */
    __pyx_t_5 = ((__pyx_v_nReads == 0) != 0);
    if (__pyx_t_5) {

      /* "vcfutils.pyx":677
 *         thisNV1, thisNV2 = [], []
 *         if nReads ==0:
 *             genotypeCalls.append([])             # <<<<<<<<<<<<<<
 *             allGTs.append(thisGTs)
 *             GLs.append(0.0)
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_genotypeCalls, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 677, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":678
 *         if nReads ==0:
 *             genotypeCalls.append([])
 *             allGTs.append(thisGTs)             # <<<<<<<<<<<<<<
 *             GLs.append(0.0)
 *             NV1s.append([])
 */
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_allGTs, __pyx_v_thisGTs); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 678, __pyx_L1_error)

      /* "vcfutils.pyx":679
 *             genotypeCalls.append([])
 *             allGTs.append(thisGTs)
 *             GLs.append(0.0)             # <<<<<<<<<<<<<<
 *             NV1s.append([])
 *             NV2s.append([])
 */
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_GLs, __pyx_float_0_0); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 679, __pyx_L1_error)

      /* "vcfutils.pyx":680
 *             allGTs.append(thisGTs)
 *             GLs.append(0.0)
 *             NV1s.append([])             # <<<<<<<<<<<<<<
 *             NV2s.append([])
 *             CFs.append(0.0)
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 680, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_NV1s, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 680, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":681
 *             GLs.append(0.0)
 *             NV1s.append([])
 *             NV2s.append([])             # <<<<<<<<<<<<<<
 *             CFs.append(0.0)
 *             continue
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 681, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_NV2s, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 681, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":682
 *             NV1s.append([])
 *             NV2s.append([])
 *             CFs.append(0.0)             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_CFs, __pyx_float_0_0); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 682, __pyx_L1_error)

      /* "vcfutils.pyx":683
 *             NV2s.append([])
 *             CFs.append(0.0)
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         indexOfBestGenotype = []
 */
      goto __pyx_L4_continue;

      /* "vcfutils.pyx":676
 *         NRs.append(nReads)
 *         thisNV1, thisNV2 = [], []
 *         if nReads ==0:             # <<<<<<<<<<<<<<
 *             genotypeCalls.append([])
 *             allGTs.append(thisGTs)
 */
    }

    /* "vcfutils.pyx":685
 *             continue
 * 
 *         indexOfBestGenotype = []             # <<<<<<<<<<<<<<
 *         maxEMLikelihood = 0.0
 *         likelihoodThisGenotype = -1e7
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 685, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_indexOfBestGenotype, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":686
 * 
 *         indexOfBestGenotype = []
 *         maxEMLikelihood = 0.0             # <<<<<<<<<<<<<<
 *         likelihoodThisGenotype = -1e7
 *         if options.alignScoreFile != "":
 */
    __pyx_v_maxEMLikelihood = 0.0;

    /* "vcfutils.pyx":687
 *         indexOfBestGenotype = []
 *         maxEMLikelihood = 0.0
 *         likelihoodThisGenotype = -1e7             # <<<<<<<<<<<<<<
 *         if options.alignScoreFile != "":
 *             for hap1 in haplotypes:
 */
    __pyx_v_likelihoodThisGenotype = -1e7;

    /* "vcfutils.pyx":688
 *         maxEMLikelihood = 0.0
 *         likelihoodThisGenotype = -1e7
 *         if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             for hap1 in haplotypes:
 *                 thisStr = hap1.shortHaplotypeSequence
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s__4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {

      /* "vcfutils.pyx":689
 *         likelihoodThisGenotype = -1e7
 *         if options.alignScoreFile != "":
 *             for hap1 in haplotypes:             # <<<<<<<<<<<<<<
 *                 thisStr = hap1.shortHaplotypeSequence
 *                 fo.write("%d %d %s\n" %(hap1.startPos+1, hap1.endPos, thisStr))
 */
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 689, __pyx_L1_error)
      }
      __pyx_t_4 = __pyx_v_haplotypes; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
      for (;;) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 689, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 689, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_hap1, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "vcfutils.pyx":690
 *         if options.alignScoreFile != "":
 *             for hap1 in haplotypes:
 *                 thisStr = hap1.shortHaplotypeSequence             # <<<<<<<<<<<<<<
 *                 fo.write("%d %d %s\n" %(hap1.startPos+1, hap1.endPos, thisStr))
 * 
 */
        __pyx_t_1 = __pyx_v_hap1->shortHaplotypeSequence;
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_thisStr, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "vcfutils.pyx":691
 *             for hap1 in haplotypes:
 *                 thisStr = hap1.shortHaplotypeSequence
 *                 fo.write("%d %d %s\n" %(hap1.startPos+1, hap1.endPos, thisStr))             # <<<<<<<<<<<<<<
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyInt_From_long((__pyx_v_hap1->startPos + 1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_hap1->endPos); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
        __Pyx_INCREF(__pyx_v_thisStr);
        __Pyx_GIVEREF(__pyx_v_thisStr);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_thisStr);
        __pyx_t_11 = 0;
        __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_d_d_s, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "vcfutils.pyx":689
 *         likelihoodThisGenotype = -1e7
 *         if options.alignScoreFile != "":
 *             for hap1 in haplotypes:             # <<<<<<<<<<<<<<
 *                 thisStr = hap1.shortHaplotypeSequence
 *                 fo.write("%d %d %s\n" %(hap1.startPos+1, hap1.endPos, thisStr))
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":688
 *         maxEMLikelihood = 0.0
 *         likelihoodThisGenotype = -1e7
 *         if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *             for hap1 in haplotypes:
 *                 thisStr = hap1.shortHaplotypeSequence
 */
    }

    /* "vcfutils.pyx":693
 *                 fo.write("%d %d %s\n" %(hap1.startPos+1, hap1.endPos, thisStr))
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:             # <<<<<<<<<<<<<<
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]
 */
    __pyx_t_13 = __pyx_v_nHaplotypes;
    for (__pyx_v_hapIndex1 = 0; __pyx_v_hapIndex1 < __pyx_t_13; __pyx_v_hapIndex1++) {

      /* "vcfutils.pyx":694
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 *             LKs = []             # <<<<<<<<<<<<<<
 *             hap1 = haplotypes[hapIndex1]
 *             arr = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd,1)
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_LKs, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":695
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]             # <<<<<<<<<<<<<<
 *             arr = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd,1)
 * 
 */
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 695, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_haplotypes, __pyx_v_hapIndex1, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 695, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_hap1, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":696
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]
 *             arr = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd,1)             # <<<<<<<<<<<<<<
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 */
      __pyx_v_arr = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_hap1->__pyx_vtab)->alignReads(__pyx_v_hap1, __pyx_v_index, __pyx_v_theBuffer->reads->windowStart, __pyx_v_theBuffer->reads->windowEnd, __pyx_v_theBuffer->badReads->windowStart, __pyx_v_theBuffer->badReads->windowEnd, __pyx_v_theBuffer->brokenMates->windowStart, __pyx_v_theBuffer->brokenMates->windowEnd, 1);
    }

    /* "vcfutils.pyx":698
 *             arr = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd,1)
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:             # <<<<<<<<<<<<<<
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]
 */
    __pyx_t_13 = __pyx_v_nHaplotypes;
    for (__pyx_v_hapIndex1 = 0; __pyx_v_hapIndex1 < __pyx_t_13; __pyx_v_hapIndex1++) {

      /* "vcfutils.pyx":699
 * 
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 *             LKs = []             # <<<<<<<<<<<<<<
 *             hap1 = haplotypes[hapIndex1]
 *             for hapIndex2 from 0<=hapIndex2 < nHaplotypes:
 */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_LKs, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":700
 *         for hapIndex1 from 0<= hapIndex1 < nHaplotypes:
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]             # <<<<<<<<<<<<<<
 *             for hapIndex2 from 0<=hapIndex2 < nHaplotypes:
 *                 hap2 = haplotypes[hapIndex2]
 */
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 700, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_haplotypes, __pyx_v_hapIndex1, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 700, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_hap1, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "vcfutils.pyx":701
 *             LKs = []
 *             hap1 = haplotypes[hapIndex1]
 *             for hapIndex2 from 0<=hapIndex2 < nHaplotypes:             # <<<<<<<<<<<<<<
 *                 hap2 = haplotypes[hapIndex2]
 *                 gt = DiploidGenotype(hap1, hap2)
 */
      __pyx_t_14 = __pyx_v_nHaplotypes;
      for (__pyx_v_hapIndex2 = 0; __pyx_v_hapIndex2 < __pyx_t_14; __pyx_v_hapIndex2++) {

        /* "vcfutils.pyx":702
 *             hap1 = haplotypes[hapIndex1]
 *             for hapIndex2 from 0<=hapIndex2 < nHaplotypes:
 *                 hap2 = haplotypes[hapIndex2]             # <<<<<<<<<<<<<<
 *                 gt = DiploidGenotype(hap1, hap2)
 *                 likelihoodThisGenotype= gt.calculateDataLikelihood(theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, index, nIndividuals, gof, options.HLATyping)
 */
        if (unlikely(__pyx_v_haplotypes == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 702, __pyx_L1_error)
        }
        __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_haplotypes, __pyx_v_hapIndex2, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_hap2, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "vcfutils.pyx":703
 *             for hapIndex2 from 0<=hapIndex2 < nHaplotypes:
 *                 hap2 = haplotypes[hapIndex2]
 *                 gt = DiploidGenotype(hap1, hap2)             # <<<<<<<<<<<<<<
 *                 likelihoodThisGenotype= gt.calculateDataLikelihood(theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, index, nIndividuals, gof, options.HLATyping)
 *                 LKs.append(likelihoodThisGenotype)
 */
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_v_hap1));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_hap1));
        PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_hap1));
        __Pyx_INCREF(((PyObject *)__pyx_v_hap2));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_hap2));
        PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_hap2));
        __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_9cgenotype_DiploidGenotype), __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF_SET(__pyx_v_gt, ((struct __pyx_obj_9cgenotype_DiploidGenotype *)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "vcfutils.pyx":704
 *                 hap2 = haplotypes[hapIndex2]
 *                 gt = DiploidGenotype(hap1, hap2)
 *                 likelihoodThisGenotype= gt.calculateDataLikelihood(theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, index, nIndividuals, gof, options.HLATyping)             # <<<<<<<<<<<<<<
 *                 LKs.append(likelihoodThisGenotype)
 *                 tempIndex = sorted([hapIndex1, hapIndex2])
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_HLATyping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 704, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_likelihoodThisGenotype = ((struct __pyx_vtabstruct_9cgenotype_DiploidGenotype *)__pyx_v_gt->__pyx_vtab)->calculateDataLikelihood(__pyx_v_gt, __pyx_v_theBuffer->reads->windowStart, __pyx_v_theBuffer->reads->windowEnd, __pyx_v_theBuffer->badReads->windowStart, __pyx_v_theBuffer->badReads->windowEnd, __pyx_v_theBuffer->brokenMates->windowStart, __pyx_v_theBuffer->brokenMates->windowEnd, __pyx_v_index, __pyx_v_nIndividuals, __pyx_v_gof, __pyx_t_15);

        /* "vcfutils.pyx":705
 *                 gt = DiploidGenotype(hap1, hap2)
 *                 likelihoodThisGenotype= gt.calculateDataLikelihood(theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, index, nIndividuals, gof, options.HLATyping)
 *                 LKs.append(likelihoodThisGenotype)             # <<<<<<<<<<<<<<
 *                 tempIndex = sorted([hapIndex1, hapIndex2])
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:
 */
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_likelihoodThisGenotype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_LKs, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 705, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "vcfutils.pyx":706
 *                 likelihoodThisGenotype= gt.calculateDataLikelihood(theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, index, nIndividuals, gof, options.HLATyping)
 *                 LKs.append(likelihoodThisGenotype)
 *                 tempIndex = sorted([hapIndex1, hapIndex2])             # <<<<<<<<<<<<<<
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:
 *                     maxEMLikelihood = likelihoodThisGenotype
 */
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_hapIndex1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_hapIndex2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 706, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 706, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_10);
        PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
        __pyx_t_4 = 0;
        __pyx_t_10 = 0;
        __pyx_t_1 = ((PyObject*)__pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_12 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 706, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_tempIndex, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "vcfutils.pyx":707
 *                 LKs.append(likelihoodThisGenotype)
 *                 tempIndex = sorted([hapIndex1, hapIndex2])
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:             # <<<<<<<<<<<<<<
 *                     maxEMLikelihood = likelihoodThisGenotype
 *                     indexOfBestGenotype = [tempIndex]
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = PyObject_RichCompare(__pyx_v_indexOfBestGenotype, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 707, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 707, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (!__pyx_t_16) {
        } else {
          __pyx_t_5 = __pyx_t_16;
          goto __pyx_L18_bool_binop_done;
        }
        __pyx_t_16 = ((__pyx_v_likelihoodThisGenotype > __pyx_v_maxEMLikelihood) != 0);
        __pyx_t_5 = __pyx_t_16;
        __pyx_L18_bool_binop_done:;
        if (__pyx_t_5) {

          /* "vcfutils.pyx":708
 *                 tempIndex = sorted([hapIndex1, hapIndex2])
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:
 *                     maxEMLikelihood = likelihoodThisGenotype             # <<<<<<<<<<<<<<
 *                     indexOfBestGenotype = [tempIndex]
 *                     secondMaxCandidates.append(likelihoodThisGenotype)
 */
          __pyx_v_maxEMLikelihood = __pyx_v_likelihoodThisGenotype;

          /* "vcfutils.pyx":709
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:
 *                     maxEMLikelihood = likelihoodThisGenotype
 *                     indexOfBestGenotype = [tempIndex]             # <<<<<<<<<<<<<<
 *                     secondMaxCandidates.append(likelihoodThisGenotype)
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:
 */
          __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 709, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_v_tempIndex);
          __Pyx_GIVEREF(__pyx_v_tempIndex);
          PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_tempIndex);
          __Pyx_DECREF_SET(__pyx_v_indexOfBestGenotype, ((PyObject*)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "vcfutils.pyx":710
 *                     maxEMLikelihood = likelihoodThisGenotype
 *                     indexOfBestGenotype = [tempIndex]
 *                     secondMaxCandidates.append(likelihoodThisGenotype)             # <<<<<<<<<<<<<<
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:
 *                     indexOfBestGenotype.append(tempIndex)
 */
          __pyx_t_9 = PyFloat_FromDouble(__pyx_v_likelihoodThisGenotype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 710, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_secondMaxCandidates, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 710, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "vcfutils.pyx":707
 *                 LKs.append(likelihoodThisGenotype)
 *                 tempIndex = sorted([hapIndex1, hapIndex2])
 *                 if indexOfBestGenotype == [] or likelihoodThisGenotype > maxEMLikelihood:             # <<<<<<<<<<<<<<
 *                     maxEMLikelihood = likelihoodThisGenotype
 *                     indexOfBestGenotype = [tempIndex]
 */
          goto __pyx_L17;
        }

        /* "vcfutils.pyx":711
 *                     indexOfBestGenotype = [tempIndex]
 *                     secondMaxCandidates.append(likelihoodThisGenotype)
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:             # <<<<<<<<<<<<<<
 *                     indexOfBestGenotype.append(tempIndex)
 *             if options.alignScoreFile != "":
 */
        __pyx_t_16 = ((__pyx_v_likelihoodThisGenotype == __pyx_v_maxEMLikelihood) != 0);
        if (__pyx_t_16) {
        } else {
          __pyx_t_5 = __pyx_t_16;
          goto __pyx_L20_bool_binop_done;
        }
        __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_v_tempIndex, __pyx_v_indexOfBestGenotype, Py_NE)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 711, __pyx_L1_error)
        __pyx_t_17 = (__pyx_t_16 != 0);
        __pyx_t_5 = __pyx_t_17;
        __pyx_L20_bool_binop_done:;
        if (__pyx_t_5) {

          /* "vcfutils.pyx":712
 *                     secondMaxCandidates.append(likelihoodThisGenotype)
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:
 *                     indexOfBestGenotype.append(tempIndex)             # <<<<<<<<<<<<<<
 *             if options.alignScoreFile != "":
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))
 */
          __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_indexOfBestGenotype, __pyx_v_tempIndex); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 712, __pyx_L1_error)

          /* "vcfutils.pyx":711
 *                     indexOfBestGenotype = [tempIndex]
 *                     secondMaxCandidates.append(likelihoodThisGenotype)
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:             # <<<<<<<<<<<<<<
 *                     indexOfBestGenotype.append(tempIndex)
 *             if options.alignScoreFile != "":
 */
        }
        __pyx_L17:;
      }

      /* "vcfutils.pyx":713
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:
 *                     indexOfBestGenotype.append(tempIndex)
 *             if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))
 *         #find the secondMaxLikelihood value to calculate confidence score
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_9, __pyx_kp_s__4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 713, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_5) {

        /* "vcfutils.pyx":714
 *                     indexOfBestGenotype.append(tempIndex)
 *             if options.alignScoreFile != "":
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))             # <<<<<<<<<<<<<<
 *         #find the secondMaxLikelihood value to calculate confidence score
 *         if len(secondMaxCandidates) > 1:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(((PyObject *)(&PyString_Type)));
        __Pyx_GIVEREF(((PyObject *)(&PyString_Type)));
        PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)(&PyString_Type)));
        __Pyx_INCREF(__pyx_v_LKs);
        __Pyx_GIVEREF(__pyx_v_LKs);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_LKs);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyString_Join(__pyx_kp_s__5, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 714, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "vcfutils.pyx":713
 *                 elif likelihoodThisGenotype == maxEMLikelihood and tempIndex not in indexOfBestGenotype:
 *                     indexOfBestGenotype.append(tempIndex)
 *             if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))
 *         #find the secondMaxLikelihood value to calculate confidence score
 */
      }
    }

    /* "vcfutils.pyx":716
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))
 *         #find the secondMaxLikelihood value to calculate confidence score
 *         if len(secondMaxCandidates) > 1:             # <<<<<<<<<<<<<<
 *             secondMaxLikelihood = sorted(secondMaxCandidates, reverse = True)[1]
 *         else:
 */
    __pyx_t_2 = PyList_GET_SIZE(__pyx_v_secondMaxCandidates); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 716, __pyx_L1_error)
    __pyx_t_5 = ((__pyx_t_2 > 1) != 0);
    if (__pyx_t_5) {

      /* "vcfutils.pyx":717
 *         #find the secondMaxLikelihood value to calculate confidence score
 *         if len(secondMaxCandidates) > 1:
 *             secondMaxLikelihood = sorted(secondMaxCandidates, reverse = True)[1]             # <<<<<<<<<<<<<<
 *         else:
 *             secondMaxLikelihood = maxEMLikelihood -100.0
 */
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_v_secondMaxCandidates);
      __Pyx_GIVEREF(__pyx_v_secondMaxCandidates);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_secondMaxCandidates);
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reverse, Py_True) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_secondMaxLikelihood = __pyx_t_18;

      /* "vcfutils.pyx":716
 *                 fo.write("%s\n" %("\t".join(map(str,LKs))))
 *         #find the secondMaxLikelihood value to calculate confidence score
 *         if len(secondMaxCandidates) > 1:             # <<<<<<<<<<<<<<
 *             secondMaxLikelihood = sorted(secondMaxCandidates, reverse = True)[1]
 *         else:
 */
      goto __pyx_L23;
    }

    /* "vcfutils.pyx":719
 *             secondMaxLikelihood = sorted(secondMaxCandidates, reverse = True)[1]
 *         else:
 *             secondMaxLikelihood = maxEMLikelihood -100.0             # <<<<<<<<<<<<<<
 * 
 *         for tempIdx, gtIndex in enumerate(indexOfBestGenotype):
 */
    /*else*/ {
      __pyx_v_secondMaxLikelihood = (__pyx_v_maxEMLikelihood - 100.0);
    }
    __pyx_L23:;

    /* "vcfutils.pyx":721
 *             secondMaxLikelihood = maxEMLikelihood -100.0
 * 
 *         for tempIdx, gtIndex in enumerate(indexOfBestGenotype):             # <<<<<<<<<<<<<<
 *             hap1, hap2 = haplotypes[gtIndex[0]], haplotypes[gtIndex[1]]
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()
 */
    __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_v_indexOfBestGenotype; __Pyx_INCREF(__pyx_t_1); __pyx_t_19 = 0;
    for (;;) {
      if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_19); __Pyx_INCREF(__pyx_t_4); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 721, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_gtIndex, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_v_tempIdx = __pyx_t_2;
      __pyx_t_2 = (__pyx_t_2 + 1);

      /* "vcfutils.pyx":722
 * 
 *         for tempIdx, gtIndex in enumerate(indexOfBestGenotype):
 *             hap1, hap2 = haplotypes[gtIndex[0]], haplotypes[gtIndex[1]]             # <<<<<<<<<<<<<<
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()
 *             varSource.add(hap1.longVar.varSource)
 */
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 722, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gtIndex, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_haplotypes, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 722, __pyx_L1_error)
      if (unlikely(__pyx_v_haplotypes == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 722, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gtIndex, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_haplotypes, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_hap1, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_9));
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_hap2, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_10));
      __pyx_t_10 = 0;

      /* "vcfutils.pyx":723
 *         for tempIdx, gtIndex in enumerate(indexOfBestGenotype):
 *             hap1, hap2 = haplotypes[gtIndex[0]], haplotypes[gtIndex[1]]
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()             # <<<<<<<<<<<<<<
 *             varSource.add(hap1.longVar.varSource)
 *             varSource.add(hap2.longVar.varSource)
 */
      __pyx_t_20 = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_hap1->__pyx_vtab)->getShortHaplotypeSequence(__pyx_v_hap1);
      __pyx_t_21 = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_hap2->__pyx_vtab)->getShortHaplotypeSequence(__pyx_v_hap2);
      __pyx_v_alt1 = __pyx_t_20;
      __pyx_v_alt2 = __pyx_t_21;

      /* "vcfutils.pyx":724
 *             hap1, hap2 = haplotypes[gtIndex[0]], haplotypes[gtIndex[1]]
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()
 *             varSource.add(hap1.longVar.varSource)             # <<<<<<<<<<<<<<
 *             varSource.add(hap2.longVar.varSource)
 *             if tempIdx ==0:
 */
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_hap1->longVar->varSource); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = PySet_Add(__pyx_v_varSource, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 724, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "vcfutils.pyx":725
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()
 *             varSource.add(hap1.longVar.varSource)
 *             varSource.add(hap2.longVar.varSource)             # <<<<<<<<<<<<<<
 *             if tempIdx ==0:
 *                 ref = hap1.shortReferenceSequence
 */
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_hap2->longVar->varSource); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = PySet_Add(__pyx_v_varSource, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 725, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "vcfutils.pyx":726
 *             varSource.add(hap1.longVar.varSource)
 *             varSource.add(hap2.longVar.varSource)
 *             if tempIdx ==0:             # <<<<<<<<<<<<<<
 *                 ref = hap1.shortReferenceSequence
 * 
 */
      __pyx_t_5 = ((__pyx_v_tempIdx == 0) != 0);
      if (__pyx_t_5) {

        /* "vcfutils.pyx":727
 *             varSource.add(hap2.longVar.varSource)
 *             if tempIdx ==0:
 *                 ref = hap1.shortReferenceSequence             # <<<<<<<<<<<<<<
 * 
 *             if alt1 != ref and alt1 not in alts:
 */
        __pyx_t_10 = __pyx_v_hap1->shortReferenceSequence;
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_DECREF_SET(__pyx_v_ref, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "vcfutils.pyx":726
 *             varSource.add(hap1.longVar.varSource)
 *             varSource.add(hap2.longVar.varSource)
 *             if tempIdx ==0:             # <<<<<<<<<<<<<<
 *                 ref = hap1.shortReferenceSequence
 * 
 */
      }

      /* "vcfutils.pyx":729
 *                 ref = hap1.shortReferenceSequence
 * 
 *             if alt1 != ref and alt1 not in alts:             # <<<<<<<<<<<<<<
 *                alts.append(alt1)
 *             if alt2 != ref and alt2 not in alts:
 */
      __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 729, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_17 = (__Pyx_PyBytes_Equals(__pyx_t_10, __pyx_v_ref, Py_NE)); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 729, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_17) {
      } else {
        __pyx_t_5 = __pyx_t_17;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 729, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_v_alts, Py_NE)); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 729, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_16 = (__pyx_t_17 != 0);
      __pyx_t_5 = __pyx_t_16;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_5) {

        /* "vcfutils.pyx":730
 * 
 *             if alt1 != ref and alt1 not in alts:
 *                alts.append(alt1)             # <<<<<<<<<<<<<<
 *             if alt2 != ref and alt2 not in alts:
 *                alts.append(alt2)
 */
        __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alts, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 730, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "vcfutils.pyx":729
 *                 ref = hap1.shortReferenceSequence
 * 
 *             if alt1 != ref and alt1 not in alts:             # <<<<<<<<<<<<<<
 *                alts.append(alt1)
 *             if alt2 != ref and alt2 not in alts:
 */
      }

      /* "vcfutils.pyx":731
 *             if alt1 != ref and alt1 not in alts:
 *                alts.append(alt1)
 *             if alt2 != ref and alt2 not in alts:             # <<<<<<<<<<<<<<
 *                alts.append(alt2)
 *             altIndex1, altIndex2 = 0 , 0
 */
      __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_16 = (__Pyx_PyBytes_Equals(__pyx_t_10, __pyx_v_ref, Py_NE)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_16) {
      } else {
        __pyx_t_5 = __pyx_t_16;
        goto __pyx_L31_bool_binop_done;
      }
      __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_16 = (__Pyx_PySequence_ContainsTF(__pyx_t_10, __pyx_v_alts, Py_NE)); if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 731, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_17 = (__pyx_t_16 != 0);
      __pyx_t_5 = __pyx_t_17;
      __pyx_L31_bool_binop_done:;
      if (__pyx_t_5) {

        /* "vcfutils.pyx":732
 *                alts.append(alt1)
 *             if alt2 != ref and alt2 not in alts:
 *                alts.append(alt2)             # <<<<<<<<<<<<<<
 *             altIndex1, altIndex2 = 0 , 0
 *             if alt1 in alts:
 */
        __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_alt2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_alts, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 732, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "vcfutils.pyx":731
 *             if alt1 != ref and alt1 not in alts:
 *                alts.append(alt1)
 *             if alt2 != ref and alt2 not in alts:             # <<<<<<<<<<<<<<
 *                alts.append(alt2)
 *             altIndex1, altIndex2 = 0 , 0
 */
      }

      /* "vcfutils.pyx":733
 *             if alt2 != ref and alt2 not in alts:
 *                alts.append(alt2)
 *             altIndex1, altIndex2 = 0 , 0             # <<<<<<<<<<<<<<
 *             if alt1 in alts:
 *                 altIndex1 = alts.index(alt1) + 1
 */
      __pyx_t_10 = __pyx_int_0;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_9 = __pyx_int_0;
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_altIndex1, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_altIndex2, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "vcfutils.pyx":734
 *                alts.append(alt2)
 *             altIndex1, altIndex2 = 0 , 0
 *             if alt1 in alts:             # <<<<<<<<<<<<<<
 *                 altIndex1 = alts.index(alt1) + 1
 *             if alt2 in alts:
 */
      __pyx_t_9 = __Pyx_PyBytes_FromString(__pyx_v_alt1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_9, __pyx_v_alts, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 734, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_17 = (__pyx_t_5 != 0);
      if (__pyx_t_17) {

        /* "vcfutils.pyx":735
 *             altIndex1, altIndex2 = 0 , 0
 *             if alt1 in alts:
 *                 altIndex1 = alts.index(alt1) + 1             # <<<<<<<<<<<<<<
 *             if alt2 in alts:
 *                 altIndex2 = alts.index(alt2) + 1
 */
        __pyx_t_9 = __Pyx_PyBytes_FromString(__pyx_v_alt1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 735, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_alts, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 735, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 735, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_altIndex1, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "vcfutils.pyx":734
 *                alts.append(alt2)
 *             altIndex1, altIndex2 = 0 , 0
 *             if alt1 in alts:             # <<<<<<<<<<<<<<
 *                 altIndex1 = alts.index(alt1) + 1
 *             if alt2 in alts:
 */
      }

      /* "vcfutils.pyx":736
 *             if alt1 in alts:
 *                 altIndex1 = alts.index(alt1) + 1
 *             if alt2 in alts:             # <<<<<<<<<<<<<<
 *                 altIndex2 = alts.index(alt2) + 1
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))
 */
      __pyx_t_9 = __Pyx_PyBytes_FromString(__pyx_v_alt2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 736, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_17 = (__Pyx_PySequence_ContainsTF(__pyx_t_9, __pyx_v_alts, Py_EQ)); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 736, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_5 = (__pyx_t_17 != 0);
      if (__pyx_t_5) {

        /* "vcfutils.pyx":737
 *                 altIndex1 = alts.index(alt1) + 1
 *             if alt2 in alts:
 *                 altIndex2 = alts.index(alt2) + 1             # <<<<<<<<<<<<<<
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))
 *             nv1, nv2 = 0, 0
 */
        __pyx_t_9 = __Pyx_PyBytes_FromString(__pyx_v_alt2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyList_Type_index, __pyx_v_alts, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 737, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_altIndex2, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "vcfutils.pyx":736
 *             if alt1 in alts:
 *                 altIndex1 = alts.index(alt1) + 1
 *             if alt2 in alts:             # <<<<<<<<<<<<<<
 *                 altIndex2 = alts.index(alt2) + 1
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))
 */
      }

      /* "vcfutils.pyx":738
 *             if alt2 in alts:
 *                 altIndex2 = alts.index(alt2) + 1
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))             # <<<<<<<<<<<<<<
 *             nv1, nv2 = 0, 0
 *             alignScoreArr1 = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 */
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_altIndex1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyNumber_Add(__pyx_t_9, __pyx_kp_s__3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_altIndex2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_thisGTs, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":739
 *                 altIndex2 = alts.index(alt2) + 1
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))
 *             nv1, nv2 = 0, 0             # <<<<<<<<<<<<<<
 *             alignScoreArr1 = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 */
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      __pyx_v_nv1 = __pyx_t_13;
      __pyx_v_nv2 = __pyx_t_14;

      /* "vcfutils.pyx":740
 *             thisGTs.append(str(altIndex1) +  "/" +str( altIndex2))
 *             nv1, nv2 = 0, 0
 *             alignScoreArr1 = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)             # <<<<<<<<<<<<<<
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             for readIndex from 0<= readIndex < nReads:
 */
      __pyx_v_alignScoreArr1 = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_hap1->__pyx_vtab)->alignReads(__pyx_v_hap1, __pyx_v_index, __pyx_v_theBuffer->reads->windowStart, __pyx_v_theBuffer->reads->windowEnd, __pyx_v_theBuffer->badReads->windowStart, __pyx_v_theBuffer->badReads->windowEnd, __pyx_v_theBuffer->brokenMates->windowStart, __pyx_v_theBuffer->brokenMates->windowEnd, 1);

      /* "vcfutils.pyx":741
 *             nv1, nv2 = 0, 0
 *             alignScoreArr1 = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)             # <<<<<<<<<<<<<<
 *             for readIndex from 0<= readIndex < nReads:
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:
 */
      __pyx_v_alignScoreArr2 = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_hap2->__pyx_vtab)->alignReads(__pyx_v_hap2, __pyx_v_index, __pyx_v_theBuffer->reads->windowStart, __pyx_v_theBuffer->reads->windowEnd, __pyx_v_theBuffer->badReads->windowStart, __pyx_v_theBuffer->badReads->windowEnd, __pyx_v_theBuffer->brokenMates->windowStart, __pyx_v_theBuffer->brokenMates->windowEnd, 1);

      /* "vcfutils.pyx":742
 *             alignScoreArr1 = hap1.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             for readIndex from 0<= readIndex < nReads:             # <<<<<<<<<<<<<<
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:
 *                     break
 */
      __pyx_t_14 = __pyx_v_nReads;
      for (__pyx_v_readIndex = 0; __pyx_v_readIndex < __pyx_t_14; __pyx_v_readIndex++) {

        /* "vcfutils.pyx":743
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             for readIndex from 0<= readIndex < nReads:
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:             # <<<<<<<<<<<<<<
 *                     break
 *                 score1 = -10 *  alignScoreArr1[readIndex]
 */
        __pyx_t_17 = (((__pyx_v_alignScoreArr1[__pyx_v_readIndex]) == 999.0) != 0);
        if (__pyx_t_17) {
        } else {
          __pyx_t_5 = __pyx_t_17;
          goto __pyx_L38_bool_binop_done;
        }
        __pyx_t_17 = (((__pyx_v_alignScoreArr2[__pyx_v_readIndex]) == 999.0) != 0);
        __pyx_t_5 = __pyx_t_17;
        __pyx_L38_bool_binop_done:;
        if (__pyx_t_5) {

          /* "vcfutils.pyx":744
 *             for readIndex from 0<= readIndex < nReads:
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:
 *                     break             # <<<<<<<<<<<<<<
 *                 score1 = -10 *  alignScoreArr1[readIndex]
 *                 score2 = -10 *  alignScoreArr2[readIndex]
 */
          goto __pyx_L36_break;

          /* "vcfutils.pyx":743
 *             alignScoreArr2 = hap2.alignReads(index, theBuffer.reads.windowStart, theBuffer.reads.windowEnd, theBuffer.badReads.windowStart, theBuffer.badReads.windowEnd, theBuffer.brokenMates.windowStart, theBuffer.brokenMates.windowEnd, True)
 *             for readIndex from 0<= readIndex < nReads:
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:             # <<<<<<<<<<<<<<
 *                     break
 *                 score1 = -10 *  alignScoreArr1[readIndex]
 */
        }

        /* "vcfutils.pyx":745
 *                 if alignScoreArr1[readIndex]==999 and alignScoreArr2[readIndex] ==999:
 *                     break
 *                 score1 = -10 *  alignScoreArr1[readIndex]             # <<<<<<<<<<<<<<
 *                 score2 = -10 *  alignScoreArr2[readIndex]
 *                 if score1 < 5:  nv1 +=1
 */
        __pyx_v_score1 = (-10.0 * (__pyx_v_alignScoreArr1[__pyx_v_readIndex]));

        /* "vcfutils.pyx":746
 *                     break
 *                 score1 = -10 *  alignScoreArr1[readIndex]
 *                 score2 = -10 *  alignScoreArr2[readIndex]             # <<<<<<<<<<<<<<
 *                 if score1 < 5:  nv1 +=1
 *                 if score2 < 5:  nv2 +=1
 */
        __pyx_v_score2 = (-10.0 * (__pyx_v_alignScoreArr2[__pyx_v_readIndex]));

        /* "vcfutils.pyx":747
 *                 score1 = -10 *  alignScoreArr1[readIndex]
 *                 score2 = -10 *  alignScoreArr2[readIndex]
 *                 if score1 < 5:  nv1 +=1             # <<<<<<<<<<<<<<
 *                 if score2 < 5:  nv2 +=1
 *             thisNV1.append(nv1)
 */
        __pyx_t_5 = ((__pyx_v_score1 < 5.0) != 0);
        if (__pyx_t_5) {
          __pyx_v_nv1 = (__pyx_v_nv1 + 1);
        }

        /* "vcfutils.pyx":748
 *                 score2 = -10 *  alignScoreArr2[readIndex]
 *                 if score1 < 5:  nv1 +=1
 *                 if score2 < 5:  nv2 +=1             # <<<<<<<<<<<<<<
 *             thisNV1.append(nv1)
 *             thisNV2.append(nv2)
 */
        __pyx_t_5 = ((__pyx_v_score2 < 5.0) != 0);
        if (__pyx_t_5) {
          __pyx_v_nv2 = (__pyx_v_nv2 + 1);
        }
      }
      __pyx_L36_break:;

      /* "vcfutils.pyx":749
 *                 if score1 < 5:  nv1 +=1
 *                 if score2 < 5:  nv2 +=1
 *             thisNV1.append(nv1)             # <<<<<<<<<<<<<<
 *             thisNV2.append(nv2)
 *         if maxEMLikelihood!=0.0:
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nv1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_thisNV1, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 749, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":750
 *                 if score2 < 5:  nv2 +=1
 *             thisNV1.append(nv1)
 *             thisNV2.append(nv2)             # <<<<<<<<<<<<<<
 *         if maxEMLikelihood!=0.0:
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nv2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_thisNV2, __pyx_t_4); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 750, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":721
 *             secondMaxLikelihood = maxEMLikelihood -100.0
 * 
 *         for tempIdx, gtIndex in enumerate(indexOfBestGenotype):             # <<<<<<<<<<<<<<
 *             hap1, hap2 = haplotypes[gtIndex[0]], haplotypes[gtIndex[1]]
 *             alt1, alt2 = hap1.getShortHaplotypeSequence(), hap2.getShortHaplotypeSequence()
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "vcfutils.pyx":751
 *             thisNV1.append(nv1)
 *             thisNV2.append(nv2)
 *         if maxEMLikelihood!=0.0:             # <<<<<<<<<<<<<<
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 *         elif len(haplotypes) > 1:
 */
    __pyx_t_5 = ((__pyx_v_maxEMLikelihood != 0.0) != 0);
    if (__pyx_t_5) {

      /* "vcfutils.pyx":752
 *             thisNV2.append(nv2)
 *         if maxEMLikelihood!=0.0:
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood             # <<<<<<<<<<<<<<
 *         elif len(haplotypes) > 1:
 *             confidenceScore = maxEMLikelihood - secondMaxLikelihood
 */
      __pyx_v_confidenceScore = (((-(__pyx_v_maxEMLikelihood - __pyx_v_secondMaxLikelihood)) * (__pyx_v_windowEnd - __pyx_v_windowStart)) / __pyx_v_maxEMLikelihood);

      /* "vcfutils.pyx":751
 *             thisNV1.append(nv1)
 *             thisNV2.append(nv2)
 *         if maxEMLikelihood!=0.0:             # <<<<<<<<<<<<<<
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 *         elif len(haplotypes) > 1:
 */
      goto __pyx_L42;
    }

    /* "vcfutils.pyx":753
 *         if maxEMLikelihood!=0.0:
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 *         elif len(haplotypes) > 1:             # <<<<<<<<<<<<<<
 *             confidenceScore = maxEMLikelihood - secondMaxLikelihood
 *         else:
 */
    if (unlikely(__pyx_v_haplotypes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
      __PYX_ERR(0, 753, __pyx_L1_error)
    }
    __pyx_t_2 = PyList_GET_SIZE(__pyx_v_haplotypes); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 753, __pyx_L1_error)
    __pyx_t_5 = ((__pyx_t_2 > 1) != 0);
    if (__pyx_t_5) {

      /* "vcfutils.pyx":754
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 *         elif len(haplotypes) > 1:
 *             confidenceScore = maxEMLikelihood - secondMaxLikelihood             # <<<<<<<<<<<<<<
 *         else:
 *             confidenceScore = 100
 */
      __pyx_v_confidenceScore = (__pyx_v_maxEMLikelihood - __pyx_v_secondMaxLikelihood);

      /* "vcfutils.pyx":753
 *         if maxEMLikelihood!=0.0:
 *             confidenceScore = -(maxEMLikelihood - secondMaxLikelihood) *  (windowEnd - windowStart)/maxEMLikelihood
 *         elif len(haplotypes) > 1:             # <<<<<<<<<<<<<<
 *             confidenceScore = maxEMLikelihood - secondMaxLikelihood
 *         else:
 */
      goto __pyx_L42;
    }

    /* "vcfutils.pyx":756
 *             confidenceScore = maxEMLikelihood - secondMaxLikelihood
 *         else:
 *             confidenceScore = 100             # <<<<<<<<<<<<<<
 * 
 *         genotypeCalls.append(indexOfBestGenotype)
 */
    /*else*/ {
      __pyx_v_confidenceScore = 100.0;
    }
    __pyx_L42:;

    /* "vcfutils.pyx":758
 *             confidenceScore = 100
 * 
 *         genotypeCalls.append(indexOfBestGenotype)             # <<<<<<<<<<<<<<
 *         allGTs.append(thisGTs)
 *         GLs.append(maxEMLikelihood)
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_genotypeCalls, __pyx_v_indexOfBestGenotype); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 758, __pyx_L1_error)

    /* "vcfutils.pyx":759
 * 
 *         genotypeCalls.append(indexOfBestGenotype)
 *         allGTs.append(thisGTs)             # <<<<<<<<<<<<<<
 *         GLs.append(maxEMLikelihood)
 *         NV1s.append(thisNV1)
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_allGTs, __pyx_v_thisGTs); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 759, __pyx_L1_error)

    /* "vcfutils.pyx":760
 *         genotypeCalls.append(indexOfBestGenotype)
 *         allGTs.append(thisGTs)
 *         GLs.append(maxEMLikelihood)             # <<<<<<<<<<<<<<
 *         NV1s.append(thisNV1)
 *         NV2s.append(thisNV2)
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_maxEMLikelihood); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_GLs, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 760, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "vcfutils.pyx":761
 *         allGTs.append(thisGTs)
 *         GLs.append(maxEMLikelihood)
 *         NV1s.append(thisNV1)             # <<<<<<<<<<<<<<
 *         NV2s.append(thisNV2)
 *         CFs.append(confidenceScore)
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_NV1s, __pyx_v_thisNV1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 761, __pyx_L1_error)

    /* "vcfutils.pyx":762
 *         GLs.append(maxEMLikelihood)
 *         NV1s.append(thisNV1)
 *         NV2s.append(thisNV2)             # <<<<<<<<<<<<<<
 *         CFs.append(confidenceScore)
 *     if options.alignScoreFile != "":
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_NV2s, __pyx_v_thisNV2); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 762, __pyx_L1_error)

    /* "vcfutils.pyx":763
 *         NV1s.append(thisNV1)
 *         NV2s.append(thisNV2)
 *         CFs.append(confidenceScore)             # <<<<<<<<<<<<<<
 *     if options.alignScoreFile != "":
 *         fo.close()
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_confidenceScore); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_CFs, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 763, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_L4_continue:;
  }

  /* "vcfutils.pyx":764
 *         NV2s.append(thisNV2)
 *         CFs.append(confidenceScore)
 *     if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *         fo.close()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_alignScoreFile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 764, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "vcfutils.pyx":765
 *         CFs.append(confidenceScore)
 *     if options.alignScoreFile != "":
 *         fo.close()             # <<<<<<<<<<<<<<
 * 
 *     theId = "."
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_fo, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "vcfutils.pyx":764
 *         NV2s.append(thisNV2)
 *         CFs.append(confidenceScore)
 *     if options.alignScoreFile != "":             # <<<<<<<<<<<<<<
 *         fo.close()
 * 
 */
  }

  /* "vcfutils.pyx":767
 *         fo.close()
 * 
 *     theId = "."             # <<<<<<<<<<<<<<
 *     qual = -1
 *     format = 'GT:GL:NR:NV1:NV2'
 */
  __Pyx_INCREF(__pyx_kp_s__2);
  __pyx_v_theId = __pyx_kp_s__2;

  /* "vcfutils.pyx":768
 * 
 *     theId = "."
 *     qual = -1             # <<<<<<<<<<<<<<
 *     format = 'GT:GL:NR:NV1:NV2'
 *     linefilter = ["PASS"]
 */
  __Pyx_INCREF(__pyx_int_neg_1);
  __pyx_v_qual = __pyx_int_neg_1;

  /* "vcfutils.pyx":769
 *     theId = "."
 *     qual = -1
 *     format = 'GT:GL:NR:NV1:NV2'             # <<<<<<<<<<<<<<
 *     linefilter = ["PASS"]
 *     linefilter = ""
 */
  __Pyx_INCREF(__pyx_kp_s_GT_GL_NR_NV1_NV2);
  __pyx_v_format = __pyx_kp_s_GT_GL_NR_NV1_NV2;

  /* "vcfutils.pyx":770
 *     qual = -1
 *     format = 'GT:GL:NR:NV1:NV2'
 *     linefilter = ["PASS"]             # <<<<<<<<<<<<<<
 *     linefilter = ""
 *     qual = max([int(cf) for cf in CFs])
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_PASS);
  __Pyx_GIVEREF(__pyx_n_s_PASS);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PASS);
  __pyx_v_linefilter = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":771
 *     format = 'GT:GL:NR:NV1:NV2'
 *     linefilter = ["PASS"]
 *     linefilter = ""             # <<<<<<<<<<<<<<
 *     qual = max([int(cf) for cf in CFs])
 *     if alts== []:
 */
  __Pyx_INCREF(__pyx_kp_s__4);
  __Pyx_DECREF_SET(__pyx_v_linefilter, __pyx_kp_s__4);

  /* "vcfutils.pyx":772
 *     linefilter = ["PASS"]
 *     linefilter = ""
 *     qual = max([int(cf) for cf in CFs])             # <<<<<<<<<<<<<<
 *     if alts== []:
 *         alts = ["."]
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __pyx_v_CFs; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_9); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 772, __pyx_L1_error)
    #else
    __pyx_t_9 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_v_cf); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_qual, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "vcfutils.pyx":773
 *     linefilter = ""
 *     qual = max([int(cf) for cf in CFs])
 *     if alts== []:             # <<<<<<<<<<<<<<
 *         alts = ["."]
 *         linefilter = "REFCALL"
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_alts, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "vcfutils.pyx":774
 *     qual = max([int(cf) for cf in CFs])
 *     if alts== []:
 *         alts = ["."]             # <<<<<<<<<<<<<<
 *         linefilter = "REFCALL"
 *     else:
 */
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_kp_s__2);
    __Pyx_GIVEREF(__pyx_kp_s__2);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s__2);
    __Pyx_DECREF_SET(__pyx_v_alts, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":775
 *     if alts== []:
 *         alts = ["."]
 *         linefilter = "REFCALL"             # <<<<<<<<<<<<<<
 *     else:
 *         linefilter = "PASS"
 */
    __Pyx_INCREF(__pyx_n_s_REFCALL);
    __Pyx_DECREF_SET(__pyx_v_linefilter, __pyx_n_s_REFCALL);

    /* "vcfutils.pyx":773
 *     linefilter = ""
 *     qual = max([int(cf) for cf in CFs])
 *     if alts== []:             # <<<<<<<<<<<<<<
 *         alts = ["."]
 *         linefilter = "REFCALL"
 */
    goto __pyx_L46;
  }

  /* "vcfutils.pyx":777
 *         linefilter = "REFCALL"
 *     else:
 *         linefilter = "PASS"             # <<<<<<<<<<<<<<
 * 
 *     infoLine = "WS=" + str(windowStart+1) + ";WE=" + str(windowEnd) + ";Size=" + str(windowEnd - windowStart + 1) + ";varSource=" + ",".join(map(str, list(varSource)))
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_n_s_PASS);
    __Pyx_DECREF_SET(__pyx_v_linefilter, __pyx_n_s_PASS);
  }
  __pyx_L46:;

  /* "vcfutils.pyx":779
 *         linefilter = "PASS"
 * 
 *     infoLine = "WS=" + str(windowStart+1) + ";WE=" + str(windowEnd) + ";Size=" + str(windowEnd - windowStart + 1) + ";varSource=" + ",".join(map(str, list(varSource)))             # <<<<<<<<<<<<<<
 *     theLine = "\t".join([chrom, str(windowStart+1), theId, ref, ",".join(alts), str(qual), linefilter,  infoLine, format])
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_windowStart + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_kp_s_WS_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_WE_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_windowEnd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_Size); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_long(((__pyx_v_windowEnd - __pyx_v_windowStart) + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_varSource); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_List(__pyx_v_varSource); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)(&PyString_Type)));
  __Pyx_GIVEREF(((PyObject *)(&PyString_Type)));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)(&PyString_Type)));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyString_Join(__pyx_kp_s__6, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_infoLine = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":780
 * 
 *     infoLine = "WS=" + str(windowStart+1) + ";WE=" + str(windowEnd) + ";Size=" + str(windowEnd - windowStart + 1) + ";varSource=" + ",".join(map(str, list(varSource)))
 *     theLine = "\t".join([chrom, str(windowStart+1), theId, ref, ",".join(alts), str(qual), linefilter,  infoLine, format])             # <<<<<<<<<<<<<<
 * 
 *     # Now pull out the genotype informations for each sample, and compute genotype likelihoods and
 */
  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_windowStart + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__6, __pyx_v_alts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_qual); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = PyList_New(9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_v_chrom);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_v_chrom);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
  __Pyx_INCREF(__pyx_v_theId);
  __Pyx_GIVEREF(__pyx_v_theId);
  PyList_SET_ITEM(__pyx_t_10, 2, __pyx_v_theId);
  __Pyx_INCREF(__pyx_v_ref);
  __Pyx_GIVEREF(__pyx_v_ref);
  PyList_SET_ITEM(__pyx_t_10, 3, __pyx_v_ref);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_10, 5, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_linefilter);
  __Pyx_GIVEREF(__pyx_v_linefilter);
  PyList_SET_ITEM(__pyx_t_10, 6, __pyx_v_linefilter);
  __Pyx_INCREF(__pyx_v_infoLine);
  __Pyx_GIVEREF(__pyx_v_infoLine);
  PyList_SET_ITEM(__pyx_t_10, 7, __pyx_v_infoLine);
  __Pyx_INCREF(__pyx_v_format);
  __Pyx_GIVEREF(__pyx_v_format);
  PyList_SET_ITEM(__pyx_t_10, 8, __pyx_v_format);
  __pyx_t_9 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Join(__pyx_kp_s__5, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_theLine = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "vcfutils.pyx":784
 *     # Now pull out the genotype informations for each sample, and compute genotype likelihoods and
 * 
 *     for i from 0 <= i < nIndividuals:             # <<<<<<<<<<<<<<
 *         theBuffer = readBuffers[i]
 *         thisSample = theBuffer.sample
 */
  __pyx_t_6 = __pyx_v_nIndividuals;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "vcfutils.pyx":785
 * 
 *     for i from 0 <= i < nIndividuals:
 *         theBuffer = readBuffers[i]             # <<<<<<<<<<<<<<
 *         thisSample = theBuffer.sample
 *         sampleLine = ":".join([",".join(allGTs[i]), str(GLs[i]), str(NRs[i]), ",".join(map(str, NV1s[i])), ",".join(map(str, NV2s[i]))])
 */
    if (unlikely(__pyx_v_readBuffers == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 785, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cwindow_bamReadBuffer))))) __PYX_ERR(0, 785, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_theBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":786
 *     for i from 0 <= i < nIndividuals:
 *         theBuffer = readBuffers[i]
 *         thisSample = theBuffer.sample             # <<<<<<<<<<<<<<
 *         sampleLine = ":".join([",".join(allGTs[i]), str(GLs[i]), str(NRs[i]), ",".join(map(str, NV1s[i])), ",".join(map(str, NV2s[i]))])
 *         theLine += "\t" + sampleLine
 */
    __pyx_t_4 = __pyx_v_theBuffer->sample;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_thisSample, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":787
 *         theBuffer = readBuffers[i]
 *         thisSample = theBuffer.sample
 *         sampleLine = ":".join([",".join(allGTs[i]), str(GLs[i]), str(NRs[i]), ",".join(map(str, NV1s[i])), ",".join(map(str, NV2s[i]))])             # <<<<<<<<<<<<<<
 *         theLine += "\t" + sampleLine
 * 
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_allGTs, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyString_Join(__pyx_kp_s__6, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_GLs, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_NRs, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_NV1s, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)(&PyString_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyString_Type)));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)(&PyString_Type)));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyString_Join(__pyx_kp_s__6, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_NV2s, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(((PyObject *)(&PyString_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyString_Type)));
    PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)(&PyString_Type)));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyString_Join(__pyx_kp_s__6, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_1);
    PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_4, 3, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_11);
    PyList_SET_ITEM(__pyx_t_4, 4, __pyx_t_11);
    __pyx_t_10 = 0;
    __pyx_t_1 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sampleLine, ((PyObject*)__pyx_t_11));
    __pyx_t_11 = 0;

    /* "vcfutils.pyx":788
 *         thisSample = theBuffer.sample
 *         sampleLine = ":".join([",".join(allGTs[i]), str(GLs[i]), str(NRs[i]), ",".join(map(str, NV1s[i])), ",".join(map(str, NV2s[i]))])
 *         theLine += "\t" + sampleLine             # <<<<<<<<<<<<<<
 * 
 *     outputFile.write("%s\n" %(theLine))
 */
    __pyx_t_11 = PyNumber_Add(__pyx_kp_s__5, __pyx_v_sampleLine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_theLine, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 788, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF_SET(__pyx_v_theLine, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;
  }

  /* "vcfutils.pyx":790
 *         theLine += "\t" + sampleLine
 * 
 *     outputFile.write("%s\n" %(theLine))             # <<<<<<<<<<<<<<
 *     free(gof)
 *     logger.debug('Out vcf writing')
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_outputFile, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_theLine); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "vcfutils.pyx":791
 * 
 *     outputFile.write("%s\n" %(theLine))
 *     free(gof)             # <<<<<<<<<<<<<<
 *     logger.debug('Out vcf writing')
 * ###################################################################################################
 */
  free(__pyx_v_gof);

  /* "vcfutils.pyx":792
 *     outputFile.write("%s\n" %(theLine))
 *     free(gof)
 *     logger.debug('Out vcf writing')             # <<<<<<<<<<<<<<
 * ###################################################################################################
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_logger); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_debug); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_4 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_kp_s_Out_vcf_writing) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_Out_vcf_writing);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "vcfutils.pyx":602
 * 
 * ###################################################################################################
 * cdef void outputHLACallToVCF(list haplotypes, list readBuffers, int nIndividuals, FastaFile refFile, outputFile, options, int windowStart, int windowEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Output a call to a vcf file. Uses the signature of the callingModule.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_WriteUnraisable("vcfutils.outputHLACallToVCF", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_haplotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_theBuffer);
  __Pyx_XDECREF(__pyx_v_thisSample);
  __Pyx_XDECREF((PyObject *)__pyx_v_longVar);
  __Pyx_XDECREF(__pyx_v_chrom);
  __Pyx_XDECREF(__pyx_v_alts);
  __Pyx_XDECREF(__pyx_v_indexOfBestGenotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_gt);
  __Pyx_XDECREF(__pyx_v_genotypeCalls);
  __Pyx_XDECREF(__pyx_v_allGTs);
  __Pyx_XDECREF(__pyx_v_thisGTs);
  __Pyx_XDECREF(__pyx_v_GLs);
  __Pyx_XDECREF(__pyx_v_NRs);
  __Pyx_XDECREF(__pyx_v_NV1s);
  __Pyx_XDECREF(__pyx_v_NV2s);
  __Pyx_XDECREF(__pyx_v_CFs);
  __Pyx_XDECREF(__pyx_v_secondMaxCandidates);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap1);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap2);
  __Pyx_XDECREF(__pyx_v_thisNV1);
  __Pyx_XDECREF(__pyx_v_thisNV2);
  __Pyx_XDECREF(__pyx_v_varSource);
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_fo);
  __Pyx_XDECREF(__pyx_v_thisStr);
  __Pyx_XDECREF(__pyx_v_LKs);
  __Pyx_XDECREF(__pyx_v_tempIndex);
  __Pyx_XDECREF(__pyx_v_gtIndex);
  __Pyx_XDECREF(__pyx_v_altIndex1);
  __Pyx_XDECREF(__pyx_v_altIndex2);
  __Pyx_XDECREF(__pyx_v_theId);
  __Pyx_XDECREF(__pyx_v_qual);
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_XDECREF(__pyx_v_linefilter);
  __Pyx_XDECREF(__pyx_v_infoLine);
  __Pyx_XDECREF(__pyx_v_theLine);
  __Pyx_XDECREF(__pyx_v_sampleLine);
  __Pyx_XDECREF(__pyx_v_cf);
  __Pyx_RefNannyFinishContext();
}

/* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */

/* Python wrapper */
static PyObject *__pyx_pw_8vcfutils_3trimLeftPadding(PyObject *__pyx_self, PyObject *__pyx_v_vcfDataLine); /*proto*/
static char __pyx_doc_8vcfutils_2trimLeftPadding[] = "\n    This is a small hack to make sure that no un-needed left padding is left\n    in the VCF output.\n    ";
static PyMethodDef __pyx_mdef_8vcfutils_3trimLeftPadding = {"trimLeftPadding", (PyCFunction)__pyx_pw_8vcfutils_3trimLeftPadding, METH_O, __pyx_doc_8vcfutils_2trimLeftPadding};
static PyObject *__pyx_pw_8vcfutils_3trimLeftPadding(PyObject *__pyx_self, PyObject *__pyx_v_vcfDataLine) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trimLeftPadding (wrapper)", 0);
  __pyx_r = __pyx_pf_8vcfutils_2trimLeftPadding(__pyx_self, ((PyObject *)__pyx_v_vcfDataLine));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_8vcfutils_15trimLeftPadding_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "vcfutils.pyx":815
 *         for i in range(1, minLenRefAlt):
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))             # <<<<<<<<<<<<<<
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))
 *             firstRefChar = ref[0].upper()
 */

static PyObject *__pyx_pf_8vcfutils_15trimLeftPadding_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)__pyx_tp_new_8vcfutils___pyx_scope_struct_1_genexpr(__pyx_ptype_8vcfutils___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 815, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8vcfutils_15trimLeftPadding_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_trimLeftPadding_locals_genexpr, __pyx_n_s_vcfutils); if (unlikely(!gen)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("vcfutils.trimLeftPadding.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_8vcfutils_15trimLeftPadding_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) { __Pyx_RaiseClosureNameError("alt"); __PYX_ERR(0, 815, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 815, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 815, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 815, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 815, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_allele);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_allele, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_allele, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_upper); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 815, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_8vcfutils_15trimLeftPadding_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "vcfutils.pyx":816
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))             # <<<<<<<<<<<<<<
 *             firstRefChar = ref[0].upper()
 * 
 */

static PyObject *__pyx_pf_8vcfutils_15trimLeftPadding_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)__pyx_tp_new_8vcfutils___pyx_scope_struct_2_genexpr(__pyx_ptype_8vcfutils___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 816, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8vcfutils_15trimLeftPadding_5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_trimLeftPadding_locals_genexpr, __pyx_n_s_vcfutils); if (unlikely(!gen)) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("vcfutils.trimLeftPadding.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_8vcfutils_15trimLeftPadding_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 816, __pyx_L1_error)
  __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) { __Pyx_RaiseClosureNameError("alt"); __PYX_ERR(0, 816, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_alt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 816, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 816, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 816, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 816, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 816, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_allele);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_allele, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = PyObject_Length(__pyx_cur_scope->__pyx_v_allele); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 816, __pyx_L1_error)
    __pyx_t_6 = ((__pyx_t_5 > 1) != 0);
    if (__pyx_t_6) {
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_allele, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_upper); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */

static PyObject *__pyx_pf_8vcfutils_2trimLeftPadding(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vcfDataLine) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *__pyx_cur_scope;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_v_minLenRefAlt = NULL;
  PyObject *__pyx_v_maxLenDiff = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_firstAltChars = NULL;
  PyObject *__pyx_v_secondAltChars = NULL;
  PyObject *__pyx_v_firstRefChar = NULL;
  PyObject *__pyx_v_allele = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("trimLeftPadding", 0);
  __pyx_cur_scope = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)__pyx_tp_new_8vcfutils___pyx_scope_struct__trimLeftPadding(__pyx_ptype_8vcfutils___pyx_scope_struct__trimLeftPadding, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 796, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "vcfutils.pyx":801
 *     in the VCF output.
 *     """
 *     ref = vcfDataLine['ref']             # <<<<<<<<<<<<<<
 *     alt = vcfDataLine['alt']
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_ref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ref = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":802
 *     """
 *     ref = vcfDataLine['ref']
 *     alt = vcfDataLine['alt']             # <<<<<<<<<<<<<<
 * 
 *     #logger.info("ref = %s. alt = %s. pos = %s" %(ref, alt, vcfDataLine['pos']))
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_vcfDataLine, __pyx_n_s_alt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_alt = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":806
 *     #logger.info("ref = %s. alt = %s. pos = %s" %(ref, alt, vcfDataLine['pos']))
 * 
 *     if alt == []:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_alt, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    goto __pyx_L3;
  }

  /* "vcfutils.pyx":810
 *     else:
 *         # Only loop up to length of shortest of all ref/alt sequences
 *         minLenRefAlt = min(len(ref), min(map(len,alt)))             # <<<<<<<<<<<<<<
 *         maxLenDiff = max([abs(len(ref) - len(allele)) for allele in alt])
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_GetBuiltinName(__pyx_n_s_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alt);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alt);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_alt);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 810, __pyx_L1_error)
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 810, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 810, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_minLenRefAlt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":811
 *         # Only loop up to length of shortest of all ref/alt sequences
 *         minLenRefAlt = min(len(ref), min(map(len,alt)))
 *         maxLenDiff = max([abs(len(ref) - len(allele)) for allele in alt])             # <<<<<<<<<<<<<<
 * 
 *         for i in range(1, minLenRefAlt):
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
      __pyx_t_2 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 811, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 811, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 811, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 811, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 811, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_7(__pyx_t_2);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 811, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_allele, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_8 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 811, __pyx_L1_error)
      __pyx_t_9 = PyObject_Length(__pyx_v_allele); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 811, __pyx_L1_error)
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_8 - __pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 811, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 811, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 811, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_maxLenDiff = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "vcfutils.pyx":813
 *         maxLenDiff = max([abs(len(ref) - len(allele)) for allele in alt])
 * 
 *         for i in range(1, minLenRefAlt):             # <<<<<<<<<<<<<<
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
    __Pyx_INCREF(__pyx_v_minLenRefAlt);
    __Pyx_GIVEREF(__pyx_v_minLenRefAlt);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_minLenRefAlt);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 813, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 813, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 813, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_7(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 813, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "vcfutils.pyx":815
 *         for i in range(1, minLenRefAlt):
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))             # <<<<<<<<<<<<<<
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))
 *             firstRefChar = ref[0].upper()
 */
      __pyx_t_1 = __pyx_pf_8vcfutils_15trimLeftPadding_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_firstAltChars, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "vcfutils.pyx":816
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))             # <<<<<<<<<<<<<<
 *             firstRefChar = ref[0].upper()
 * 
 */
      __pyx_t_1 = __pyx_pf_8vcfutils_15trimLeftPadding_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PySequence_List(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_secondAltChars, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "vcfutils.pyx":817
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 *             secondAltChars = list(set(allele[1].upper() for allele in alt if len(allele) > 1))
 *             firstRefChar = ref[0].upper()             # <<<<<<<<<<<<<<
 * 
 *             #logger.info("Len first alt chars = %s. First Ref = %s. First alt = %s" %(len(firstAltChars), firstRefChar, firstAltChars[0]))
 */
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_ref, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_upper); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_firstRefChar, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "vcfutils.pyx":823
 * 
 *             # Stop if alt alleles don't have same first character, or don't match ref
 *             if len(firstAltChars) > 1 or firstRefChar != firstAltChars[0]:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_9 = PyList_GET_SIZE(__pyx_v_firstAltChars); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 823, __pyx_L1_error)
      __pyx_t_10 = ((__pyx_t_9 > 1) != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_3 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_firstRefChar, PyList_GET_ITEM(__pyx_v_firstAltChars, 0), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 823, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_3) {

        /* "vcfutils.pyx":824
 *             # Stop if alt alleles don't have same first character, or don't match ref
 *             if len(firstAltChars) > 1 or firstRefChar != firstAltChars[0]:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             # Stop if there are indels present, and the 2nd base disagrees. This is because VCF
 */
        goto __pyx_L7_break;

        /* "vcfutils.pyx":823
 * 
 *             # Stop if alt alleles don't have same first character, or don't match ref
 *             if len(firstAltChars) > 1 or firstRefChar != firstAltChars[0]:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      }

      /* "vcfutils.pyx":829
 *             # represents indels with a leading reference base. N.B. Need to check the second
 *             # base on all alt alleles, not just the first
 *             elif maxLenDiff > 0 and (len(secondAltChars) > 1 or ref[1] != secondAltChars[0]):             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxLenDiff, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_10) {
      } else {
        __pyx_t_3 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_9 = PyList_GET_SIZE(__pyx_v_secondAltChars); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 829, __pyx_L1_error)
      __pyx_t_10 = ((__pyx_t_9 > 1) != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_3 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_ref, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, PyList_GET_ITEM(__pyx_v_secondAltChars, 0), Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_3 = __pyx_t_10;
      __pyx_L11_bool_binop_done:;
      if (__pyx_t_3) {

        /* "vcfutils.pyx":830
 *             # base on all alt alleles, not just the first
 *             elif maxLenDiff > 0 and (len(secondAltChars) > 1 or ref[1] != secondAltChars[0]):
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             # Trim one base from ref and all alts, and adjust position
 */
        goto __pyx_L7_break;

        /* "vcfutils.pyx":829
 *             # represents indels with a leading reference base. N.B. Need to check the second
 *             # base on all alt alleles, not just the first
 *             elif maxLenDiff > 0 and (len(secondAltChars) > 1 or ref[1] != secondAltChars[0]):             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      }

      /* "vcfutils.pyx":833
 * 
 *             # Trim one base from ref and all alts, and adjust position
 *             ref, alt = ref[1:], [allele[1:] for allele in alt]             # <<<<<<<<<<<<<<
 *             vcfDataLine['pos'] += 1
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_v_ref, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_alt)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_alt)) {
        __pyx_t_5 = __pyx_cur_scope->__pyx_v_alt; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
        __pyx_t_11 = NULL;
      } else {
        __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_alt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 833, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 833, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_11)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_12); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 833, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          } else {
            if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_12); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 833, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 833, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          }
        } else {
          __pyx_t_12 = __pyx_t_11(__pyx_t_5);
          if (unlikely(!__pyx_t_12)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 833, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_XDECREF_SET(__pyx_v_allele, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_allele, 1, 0, NULL, NULL, &__pyx_slice__8, 1, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 833, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 833, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_ref, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_alt);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_alt, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;

      /* "vcfutils.pyx":834
 *             # Trim one base from ref and all alts, and adjust position
 *             ref, alt = ref[1:], [allele[1:] for allele in alt]
 *             vcfDataLine['pos'] += 1             # <<<<<<<<<<<<<<
 * 
 *     #logger.info("now ref = %s. alt = %s. pos = %s" %(ref, alt, vcfDataLine['pos']))
 */
      __Pyx_INCREF(__pyx_n_s_pos);
      __pyx_t_13 = __pyx_n_s_pos;
      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_vcfDataLine, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 834, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(PyObject_SetItem(__pyx_v_vcfDataLine, __pyx_t_13, __pyx_t_6) < 0)) __PYX_ERR(0, 834, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "vcfutils.pyx":813
 *         maxLenDiff = max([abs(len(ref) - len(allele)) for allele in alt])
 * 
 *         for i in range(1, minLenRefAlt):             # <<<<<<<<<<<<<<
 * 
 *             firstAltChars = list(set(allele[0].upper() for allele in alt))
 */
    }
    __pyx_L7_break:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "vcfutils.pyx":838
 *     #logger.info("now ref = %s. alt = %s. pos = %s" %(ref, alt, vcfDataLine['pos']))
 * 
 *     vcfDataLine['ref'] = ref             # <<<<<<<<<<<<<<
 *     vcfDataLine['alt'] = alt
 * 
 */
  if (unlikely(PyObject_SetItem(__pyx_v_vcfDataLine, __pyx_n_s_ref, __pyx_v_ref) < 0)) __PYX_ERR(0, 838, __pyx_L1_error)

  /* "vcfutils.pyx":839
 * 
 *     vcfDataLine['ref'] = ref
 *     vcfDataLine['alt'] = alt             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  if (unlikely(PyObject_SetItem(__pyx_v_vcfDataLine, __pyx_n_s_alt, __pyx_cur_scope->__pyx_v_alt) < 0)) __PYX_ERR(0, 839, __pyx_L1_error)

  /* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("vcfutils.trimLeftPadding", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_v_minLenRefAlt);
  __Pyx_XDECREF(__pyx_v_maxLenDiff);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_firstAltChars);
  __Pyx_XDECREF(__pyx_v_secondAltChars);
  __Pyx_XDECREF(__pyx_v_firstRefChar);
  __Pyx_XDECREF(__pyx_v_allele);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":843
 * ###################################################################################################
 * 
 * cdef tuple refAndAlt(char* chrom, int POS, list variants, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     Calculates the right REF and ALT fields for a set of variants.
 */

static PyObject *__pyx_f_8vcfutils_refAndAlt(char *__pyx_v_chrom, int __pyx_v_POS, PyObject *__pyx_v_variants, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile) {
  int __pyx_v_nonSnpPresent;
  int __pyx_v_indelPresent;
  struct __pyx_obj_7variant_Variant *__pyx_v_v = 0;
  PyObject *__pyx_v_ALT = 0;
  PyObject *__pyx_v_seq = 0;
  PyObject *__pyx_v_REF = 0;
  int __pyx_v_nAdded;
  int __pyx_v_nRemoved;
  PyObject *__pyx_v_rlen = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PY_LONG_LONG __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("refAndAlt", 0);

  /* "vcfutils.pyx":850
 *     http://1000genomes.org/wiki/doku.php?do=show&id=1000_genomes%3Aanalysis%3Avcf4.0
 *     """
 *     cdef int nonSnpPresent = 0             # <<<<<<<<<<<<<<
 *     cdef int indelPresent = 0
 *     cdef Variant v
 */
  __pyx_v_nonSnpPresent = 0;

  /* "vcfutils.pyx":851
 *     """
 *     cdef int nonSnpPresent = 0
 *     cdef int indelPresent = 0             # <<<<<<<<<<<<<<
 *     cdef Variant v
 *     cdef list ALT
 */
  __pyx_v_indelPresent = 0;

  /* "vcfutils.pyx":857
 *     cdef bytes REF
 * 
 *     for v in variants:             # <<<<<<<<<<<<<<
 *         nAdded = v.nAdded
 *         nRemoved = v.nRemoved
 */
  if (unlikely(__pyx_v_variants == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 857, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 857, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 857, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":858
 * 
 *     for v in variants:
 *         nAdded = v.nAdded             # <<<<<<<<<<<<<<
 *         nRemoved = v.nRemoved
 * 
 */
    __pyx_t_4 = __pyx_v_v->nAdded;
    __pyx_v_nAdded = __pyx_t_4;

    /* "vcfutils.pyx":859
 *     for v in variants:
 *         nAdded = v.nAdded
 *         nRemoved = v.nRemoved             # <<<<<<<<<<<<<<
 * 
 *         if nRemoved != 1 or nAdded != 1:
 */
    __pyx_t_4 = __pyx_v_v->nRemoved;
    __pyx_v_nRemoved = __pyx_t_4;

    /* "vcfutils.pyx":861
 *         nRemoved = v.nRemoved
 * 
 *         if nRemoved != 1 or nAdded != 1:             # <<<<<<<<<<<<<<
 *             nonSnpPresent = 1
 * 
 */
    __pyx_t_6 = ((__pyx_v_nRemoved != 1) != 0);
    if (!__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = ((__pyx_v_nAdded != 1) != 0);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {

      /* "vcfutils.pyx":862
 * 
 *         if nRemoved != 1 or nAdded != 1:
 *             nonSnpPresent = 1             # <<<<<<<<<<<<<<
 * 
 *             if nRemoved != nAdded:
 */
      __pyx_v_nonSnpPresent = 1;

      /* "vcfutils.pyx":864
 *             nonSnpPresent = 1
 * 
 *             if nRemoved != nAdded:             # <<<<<<<<<<<<<<
 *                 indelPresent = 1
 * 
 */
      __pyx_t_5 = ((__pyx_v_nRemoved != __pyx_v_nAdded) != 0);
      if (__pyx_t_5) {

        /* "vcfutils.pyx":865
 * 
 *             if nRemoved != nAdded:
 *                 indelPresent = 1             # <<<<<<<<<<<<<<
 * 
 *     if not nonSnpPresent:
 */
        __pyx_v_indelPresent = 1;

        /* "vcfutils.pyx":864
 *             nonSnpPresent = 1
 * 
 *             if nRemoved != nAdded:             # <<<<<<<<<<<<<<
 *                 indelPresent = 1
 * 
 */
      }

      /* "vcfutils.pyx":861
 *         nRemoved = v.nRemoved
 * 
 *         if nRemoved != 1 or nAdded != 1:             # <<<<<<<<<<<<<<
 *             nonSnpPresent = 1
 * 
 */
    }

    /* "vcfutils.pyx":857
 *     cdef bytes REF
 * 
 *     for v in variants:             # <<<<<<<<<<<<<<
 *         nAdded = v.nAdded
 *         nRemoved = v.nRemoved
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":867
 *                 indelPresent = 1
 * 
 *     if not nonSnpPresent:             # <<<<<<<<<<<<<<
 *         # Just SNPs
 *         REF = refFile.getCharacter(chrom, POS)
 */
  __pyx_t_5 = ((!(__pyx_v_nonSnpPresent != 0)) != 0);
  if (__pyx_t_5) {

    /* "vcfutils.pyx":869
 *     if not nonSnpPresent:
 *         # Just SNPs
 *         REF = refFile.getCharacter(chrom, POS)             # <<<<<<<<<<<<<<
 *         ALT = [ v.added for v in variants ]
 *         return REF,ALT
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getCharacter(__pyx_v_refFile, ((PyObject*)__pyx_t_1), __pyx_v_POS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_REF = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":870
 *         # Just SNPs
 *         REF = refFile.getCharacter(chrom, POS)
 *         ALT = [ v.added for v in variants ]             # <<<<<<<<<<<<<<
 *         return REF,ALT
 *     else:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 870, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 870, __pyx_L1_error)
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 870, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 870, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_7));
      __pyx_t_7 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_v->added))) __PYX_ERR(0, 870, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_ALT = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":871
 *         REF = refFile.getCharacter(chrom, POS)
 *         ALT = [ v.added for v in variants ]
 *         return REF,ALT             # <<<<<<<<<<<<<<
 *     else:
 *         # If there are indels around, then the reference base is the base before the insertion
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_REF);
    __Pyx_GIVEREF(__pyx_v_REF);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_REF);
    __Pyx_INCREF(__pyx_v_ALT);
    __Pyx_GIVEREF(__pyx_v_ALT);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_ALT);
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "vcfutils.pyx":867
 *                 indelPresent = 1
 * 
 *     if not nonSnpPresent:             # <<<<<<<<<<<<<<
 *         # Just SNPs
 *         REF = refFile.getCharacter(chrom, POS)
 */
  }

  /* "vcfutils.pyx":877
 *         # snps will have two bases
 * 
 *         rlen = max([v.nRemoved for v in variants]) # number of extra bases in REF             # <<<<<<<<<<<<<<
 *         REF = None
 * 
 */
  /*else*/ {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 877, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 877, __pyx_L1_error)
      #else
      __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_7));
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_v->nRemoved); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 877, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_rlen = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":878
 * 
 *         rlen = max([v.nRemoved for v in variants]) # number of extra bases in REF
 *         REF = None             # <<<<<<<<<<<<<<
 * 
 *         if indelPresent:
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_REF = ((PyObject*)Py_None);

    /* "vcfutils.pyx":880
 *         REF = None
 * 
 *         if indelPresent:             # <<<<<<<<<<<<<<
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen) + 1)
 *         else:
 */
    __pyx_t_5 = (__pyx_v_indelPresent != 0);
    if (__pyx_t_5) {

      /* "vcfutils.pyx":881
 * 
 *         if indelPresent:
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen) + 1)             # <<<<<<<<<<<<<<
 *         else:
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen))
 */
      __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_POS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_v_rlen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_3); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, ((PyObject*)__pyx_t_1), __pyx_v_POS, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_REF, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "vcfutils.pyx":880
 *         REF = None
 * 
 *         if indelPresent:             # <<<<<<<<<<<<<<
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen) + 1)
 *         else:
 */
      goto __pyx_L14;
    }

    /* "vcfutils.pyx":883
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen) + 1)
 *         else:
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen))             # <<<<<<<<<<<<<<
 * 
 *         ALT = []
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_chrom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_POS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_rlen); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_7); if (unlikely((__pyx_t_8 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = ((struct __pyx_vtabstruct_9fastafile_FastaFile *)__pyx_v_refFile->__pyx_vtab)->getSequence(__pyx_v_refFile, ((PyObject*)__pyx_t_3), __pyx_v_POS, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_REF, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;
    }
    __pyx_L14:;

    /* "vcfutils.pyx":885
 *             REF = refFile.getSequence(chrom, POS, (POS+rlen))
 * 
 *         ALT = []             # <<<<<<<<<<<<<<
 * 
 *         for v in variants:
 */
    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_v_ALT = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "vcfutils.pyx":887
 *         ALT = []
 * 
 *         for v in variants:             # <<<<<<<<<<<<<<
 *             seq = list(REF)
 * 
 */
    if (unlikely(__pyx_v_variants == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 887, __pyx_L1_error)
    }
    __pyx_t_7 = __pyx_v_variants; __Pyx_INCREF(__pyx_t_7); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_7)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 887, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 887, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "vcfutils.pyx":888
 * 
 *         for v in variants:
 *             seq = list(REF)             # <<<<<<<<<<<<<<
 * 
 *             if v.nRemoved == v.nAdded:
 */
      __pyx_t_3 = PySequence_List(__pyx_v_REF); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 888, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_seq, ((PyObject*)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "vcfutils.pyx":890
 *             seq = list(REF)
 * 
 *             if v.nRemoved == v.nAdded:             # <<<<<<<<<<<<<<
 *                 seq[0: len(v.added)] = v.added
 *             else:
 */
      __pyx_t_5 = ((__pyx_v_v->nRemoved == __pyx_v_v->nAdded) != 0);
      if (__pyx_t_5) {

        /* "vcfutils.pyx":891
 * 
 *             if v.nRemoved == v.nAdded:
 *                 seq[0: len(v.added)] = v.added             # <<<<<<<<<<<<<<
 *             else:
 *                 seq[1:1+v.nRemoved] = v.added
 */
        __pyx_t_3 = __pyx_v_v->added;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_1 = __pyx_v_v->added;
        __Pyx_INCREF(__pyx_t_1);
        if (unlikely(__pyx_t_1 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
          __PYX_ERR(0, 891, __pyx_L1_error)
        }
        __pyx_t_9 = PyBytes_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 891, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__Pyx_PyObject_SetSlice(__pyx_v_seq, __pyx_t_3, 0, __pyx_t_9, NULL, NULL, NULL, 1, 1, 1) < 0) __PYX_ERR(0, 891, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "vcfutils.pyx":890
 *             seq = list(REF)
 * 
 *             if v.nRemoved == v.nAdded:             # <<<<<<<<<<<<<<
 *                 seq[0: len(v.added)] = v.added
 *             else:
 */
        goto __pyx_L17;
      }

      /* "vcfutils.pyx":893
 *                 seq[0: len(v.added)] = v.added
 *             else:
 *                 seq[1:1+v.nRemoved] = v.added             # <<<<<<<<<<<<<<
 * 
 *             ALT.append("".join(seq))
 */
      /*else*/ {
        __pyx_t_3 = __pyx_v_v->added;
        __Pyx_INCREF(__pyx_t_3);
        if (__Pyx_PyObject_SetSlice(__pyx_v_seq, __pyx_t_3, 1, (1 + __pyx_v_v->nRemoved), NULL, NULL, NULL, 1, 1, 1) < 0) __PYX_ERR(0, 893, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __pyx_L17:;

      /* "vcfutils.pyx":895
 *                 seq[1:1+v.nRemoved] = v.added
 * 
 *             ALT.append("".join(seq))             # <<<<<<<<<<<<<<
 * 
 *         return REF,ALT
 */
      __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s__4, __pyx_v_seq); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_ALT, __pyx_t_3); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 895, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":887
 *         ALT = []
 * 
 *         for v in variants:             # <<<<<<<<<<<<<<
 *             seq = list(REF)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "vcfutils.pyx":897
 *             ALT.append("".join(seq))
 * 
 *         return REF,ALT             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_REF);
    __Pyx_GIVEREF(__pyx_v_REF);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_REF);
    __Pyx_INCREF(__pyx_v_ALT);
    __Pyx_GIVEREF(__pyx_v_ALT);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_ALT);
    __pyx_r = ((PyObject*)__pyx_t_7);
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "vcfutils.pyx":843
 * ###################################################################################################
 * 
 * cdef tuple refAndAlt(char* chrom, int POS, list variants, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     Calculates the right REF and ALT fields for a set of variants.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("vcfutils.refAndAlt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_ALT);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_REF);
  __Pyx_XDECREF(__pyx_v_rlen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":901
 * ###################################################################################################
 * 
 * cdef int readOverlapsVariant(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos):             # <<<<<<<<<<<<<<
 *     """
 *     Check if a read overlaps the variant position
 */

static int __pyx_f_8vcfutils_readOverlapsVariant(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_pRead, int __pyx_v_varBAMMinPos, int __pyx_v_varBAMMaxPos) {
  int __pyx_v_readStart;
  int __pyx_v_readEnd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("readOverlapsVariant", 0);

  /* "vcfutils.pyx":905
 *     Check if a read overlaps the variant position
 *     """
 *     cdef int readStart = pRead.pos             # <<<<<<<<<<<<<<
 *     cdef int readEnd = pRead.end
 * 
 */
  __pyx_t_1 = __pyx_v_pRead->pos;
  __pyx_v_readStart = __pyx_t_1;

  /* "vcfutils.pyx":906
 *     """
 *     cdef int readStart = pRead.pos
 *     cdef int readEnd = pRead.end             # <<<<<<<<<<<<<<
 * 
 *     if readStart <= varBAMMaxPos and readEnd > varBAMMinPos:
 */
  __pyx_t_1 = __pyx_v_pRead->end;
  __pyx_v_readEnd = __pyx_t_1;

  /* "vcfutils.pyx":908
 *     cdef int readEnd = pRead.end
 * 
 *     if readStart <= varBAMMaxPos and readEnd > varBAMMinPos:             # <<<<<<<<<<<<<<
 *         #logger.info("Read %s - %s overlaps var %s - %s" %(readStart, readEnd, varBAMMinPos, varBAMMaxPos))
 *         return True
 */
  __pyx_t_3 = ((__pyx_v_readStart <= __pyx_v_varBAMMaxPos) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_readEnd > __pyx_v_varBAMMinPos) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "vcfutils.pyx":910
 *     if readStart <= varBAMMaxPos and readEnd > varBAMMinPos:
 *         #logger.info("Read %s - %s overlaps var %s - %s" %(readStart, readEnd, varBAMMinPos, varBAMMaxPos))
 *         return True             # <<<<<<<<<<<<<<
 *     else:
 *         #logger.info("Read %s -%s does not overlap var %s - %s" %(readStart, readEnd, varBAMMinPos, varBAMMaxPos))
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "vcfutils.pyx":908
 *     cdef int readEnd = pRead.end
 * 
 *     if readStart <= varBAMMaxPos and readEnd > varBAMMinPos:             # <<<<<<<<<<<<<<
 *         #logger.info("Read %s - %s overlaps var %s - %s" %(readStart, readEnd, varBAMMinPos, varBAMMaxPos))
 *         return True
 */
  }

  /* "vcfutils.pyx":913
 *     else:
 *         #logger.info("Read %s -%s does not overlap var %s - %s" %(readStart, readEnd, varBAMMinPos, varBAMMaxPos))
 *         return False             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  /*else*/ {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "vcfutils.pyx":901
 * ###################################################################################################
 * 
 * cdef int readOverlapsVariant(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos):             # <<<<<<<<<<<<<<
 *     """
 *     Check if a read overlaps the variant position
 */

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

/* "vcfutils.pyx":917
 * ###################################################################################################
 * 
 * cdef int readQualIsGoodVariantPosition(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos, int minBaseQual):             # <<<<<<<<<<<<<<
 *     """
 *     If a read overlaps the variant position, then check the qualities at that position. If quals
 */

static int __pyx_f_8vcfutils_readQualIsGoodVariantPosition(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_pRead, int __pyx_v_varBAMMinPos, int __pyx_v_varBAMMaxPos, CYTHON_UNUSED int __pyx_v_minBaseQual) {
  CYTHON_UNUSED int __pyx_v_readStart;
  CYTHON_UNUSED int __pyx_v_readEnd;
  char *__pyx_v_qualStart;
  char *__pyx_v_qualEnd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  short __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  long __pyx_t_6;
  __Pyx_RefNannySetupContext("readQualIsGoodVariantPosition", 0);

  /* "vcfutils.pyx":922
 *     are all < minBaseQual, then return False, otherwise True
 *     """
 *     if pRead.qual == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_1 = ((__pyx_v_pRead->qual == NULL) != 0);
  if (__pyx_t_1) {

    /* "vcfutils.pyx":923
 *     """
 *     if pRead.qual == NULL:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     cdef int readStart = pRead.pos
 */
    __pyx_r = 1;
    goto __pyx_L0;

    /* "vcfutils.pyx":922
 *     are all < minBaseQual, then return False, otherwise True
 *     """
 *     if pRead.qual == NULL:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  }

  /* "vcfutils.pyx":925
 *         return True
 * 
 *     cdef int readStart = pRead.pos             # <<<<<<<<<<<<<<
 *     cdef int readEnd = pRead.end
 * 
 */
  __pyx_t_2 = __pyx_v_pRead->pos;
  __pyx_v_readStart = __pyx_t_2;

  /* "vcfutils.pyx":926
 * 
 *     cdef int readStart = pRead.pos
 *     cdef int readEnd = pRead.end             # <<<<<<<<<<<<<<
 * 
 *     cdef char* qualStart = pRead.qual + max(0, min(pRead.rlen, varBAMMinPos - pRead.pos))
 */
  __pyx_t_2 = __pyx_v_pRead->end;
  __pyx_v_readEnd = __pyx_t_2;

  /* "vcfutils.pyx":928
 *     cdef int readEnd = pRead.end
 * 
 *     cdef char* qualStart = pRead.qual + max(0, min(pRead.rlen, varBAMMinPos - pRead.pos))             # <<<<<<<<<<<<<<
 *     cdef char* qualEnd = pRead.qual + max(0, min(pRead.rlen, varBAMMaxPos - pRead.pos))
 * 
 */
  __pyx_t_2 = (__pyx_v_varBAMMinPos - __pyx_v_pRead->pos);
  __pyx_t_3 = __pyx_v_pRead->rlen;
  if (((__pyx_t_2 < __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_t_2 = __pyx_t_4;
  __pyx_t_5 = 0;
  if (((__pyx_t_2 > __pyx_t_5) != 0)) {
    __pyx_t_6 = __pyx_t_2;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_v_qualStart = (__pyx_v_pRead->qual + __pyx_t_6);

  /* "vcfutils.pyx":929
 * 
 *     cdef char* qualStart = pRead.qual + max(0, min(pRead.rlen, varBAMMinPos - pRead.pos))
 *     cdef char* qualEnd = pRead.qual + max(0, min(pRead.rlen, varBAMMaxPos - pRead.pos))             # <<<<<<<<<<<<<<
 * 
 *     # Conservative. I want good coverage all the way across
 */
  __pyx_t_2 = (__pyx_v_varBAMMaxPos - __pyx_v_pRead->pos);
  __pyx_t_3 = __pyx_v_pRead->rlen;
  if (((__pyx_t_2 < __pyx_t_3) != 0)) {
    __pyx_t_4 = __pyx_t_2;
  } else {
    __pyx_t_4 = __pyx_t_3;
  }
  __pyx_t_2 = __pyx_t_4;
  __pyx_t_6 = 0;
  if (((__pyx_t_2 > __pyx_t_6) != 0)) {
    __pyx_t_5 = __pyx_t_2;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  __pyx_v_qualEnd = (__pyx_v_pRead->qual + __pyx_t_5);

  /* "vcfutils.pyx":932
 * 
 *     # Conservative. I want good coverage all the way across
 *     while qualStart != qualEnd:             # <<<<<<<<<<<<<<
 * 
 *         #logger.info("Base at pos %s has qual %s. Var min = %s. Var max = %s" %(readStart + (qualStart - pRead.qual), qualStart[0], varBAMMinPos, varBAMMaxPos))
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_qualStart != __pyx_v_qualEnd) != 0);
    if (!__pyx_t_1) break;

    /* "vcfutils.pyx":938
 *         # Ok, this is a slight fudge, as I still want to catch those cases when there's a mis-match supporting
 *         # a variant with a low-ish quality. I'm just not counting coverage which is very low quality.
 *         if qualStart[0] < 5:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = (((__pyx_v_qualStart[0]) < 5) != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":939
 *         # a variant with a low-ish quality. I'm just not counting coverage which is very low quality.
 *         if qualStart[0] < 5:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         qualStart += 1
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "vcfutils.pyx":938
 *         # Ok, this is a slight fudge, as I still want to catch those cases when there's a mis-match supporting
 *         # a variant with a low-ish quality. I'm just not counting coverage which is very low quality.
 *         if qualStart[0] < 5:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    }

    /* "vcfutils.pyx":941
 *             return False
 * 
 *         qualStart += 1             # <<<<<<<<<<<<<<
 * 
 *     return True
 */
    __pyx_v_qualStart = (__pyx_v_qualStart + 1);
  }

  /* "vcfutils.pyx":943
 *         qualStart += 1
 * 
 *     return True             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "vcfutils.pyx":917
 * ###################################################################################################
 * 
 * cdef int readQualIsGoodVariantPosition(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos, int minBaseQual):             # <<<<<<<<<<<<<<
 *     """
 *     If a read overlaps the variant position, then check the qualities at that position. If quals
 */

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

/* "vcfutils.pyx":947
 * ###################################################################################################
 * 
 * cdef int overlap(int varStart, int varEnd, int seqStart, int seqEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return the number of bases by which a read overlaps the haplotype of interest.
 */

static int __pyx_f_8vcfutils_overlap(int __pyx_v_varStart, int __pyx_v_varEnd, int __pyx_v_seqStart, int __pyx_v_seqEnd) {
  int __pyx_v_overlapStart;
  int __pyx_v_overlapEnd;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("overlap", 0);

  /* "vcfutils.pyx":951
 *     Compute and return the number of bases by which a read overlaps the haplotype of interest.
 *     """
 *     cdef int overlapStart = max(varStart, seqStart)             # <<<<<<<<<<<<<<
 *     cdef int overlapEnd = min(varEnd, seqEnd)
 * 
 */
  __pyx_t_1 = __pyx_v_seqStart;
  __pyx_t_2 = __pyx_v_varStart;
  if (((__pyx_t_1 > __pyx_t_2) != 0)) {
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  __pyx_v_overlapStart = __pyx_t_3;

  /* "vcfutils.pyx":952
 *     """
 *     cdef int overlapStart = max(varStart, seqStart)
 *     cdef int overlapEnd = min(varEnd, seqEnd)             # <<<<<<<<<<<<<<
 * 
 *     if overlapEnd > overlapStart:
 */
  __pyx_t_3 = __pyx_v_seqEnd;
  __pyx_t_1 = __pyx_v_varEnd;
  if (((__pyx_t_3 < __pyx_t_1) != 0)) {
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  __pyx_v_overlapEnd = __pyx_t_2;

  /* "vcfutils.pyx":954
 *     cdef int overlapEnd = min(varEnd, seqEnd)
 * 
 *     if overlapEnd > overlapStart:             # <<<<<<<<<<<<<<
 *         return overlapEnd - overlapStart
 *     else:
 */
  __pyx_t_4 = ((__pyx_v_overlapEnd > __pyx_v_overlapStart) != 0);
  if (__pyx_t_4) {

    /* "vcfutils.pyx":955
 * 
 *     if overlapEnd > overlapStart:
 *         return overlapEnd - overlapStart             # <<<<<<<<<<<<<<
 *     else:
 *         return -1
 */
    __pyx_r = (__pyx_v_overlapEnd - __pyx_v_overlapStart);
    goto __pyx_L0;

    /* "vcfutils.pyx":954
 *     cdef int overlapEnd = min(varEnd, seqEnd)
 * 
 *     if overlapEnd > overlapStart:             # <<<<<<<<<<<<<<
 *         return overlapEnd - overlapStart
 *     else:
 */
  }

  /* "vcfutils.pyx":957
 *         return overlapEnd - overlapStart
 *     else:
 *         return -1             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  /*else*/ {
    __pyx_r = -1;
    goto __pyx_L0;
  }

  /* "vcfutils.pyx":947
 * ###################################################################################################
 * 
 * cdef int overlap(int varStart, int varEnd, int seqStart, int seqEnd):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return the number of bases by which a read overlaps the haplotype of interest.
 */

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

/* "vcfutils.pyx":961
 * ###################################################################################################
 * 
 * cdef int variantSupportedByRead(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos, Variant variant, int countOnlyExactIndelMatches):             # <<<<<<<<<<<<<<
 *     """
 *     Return True if the specified variant is supported by the specified read
 */

static int __pyx_f_8vcfutils_variantSupportedByRead(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_pRead, CYTHON_UNUSED int __pyx_v_varBAMMinPos, CYTHON_UNUSED int __pyx_v_varBAMMaxPos, struct __pyx_obj_7variant_Variant *__pyx_v_variant, int __pyx_v_countOnlyExactIndelMatches) {
  int __pyx_v_refOffset;
  int __pyx_v_readOffset;
  int __pyx_v_readStart;
  CYTHON_UNUSED int __pyx_v_match;
  int __pyx_v_cigarIndex;
  int __pyx_v_cigarLength;
  int __pyx_v_flag;
  int __pyx_v_length;
  int __pyx_v_startPosOfVarInRead;
  int __pyx_v_varPos;
  int __pyx_v_lenVarAdded;
  int __pyx_v_lenVarRemoved;
  char *__pyx_v_varAdded;
  CYTHON_UNUSED char *__pyx_v_varRemoved;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  short __pyx_t_2;
  char *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("variantSupportedByRead", 0);

  /* "vcfutils.pyx":965
 *     Return True if the specified variant is supported by the specified read
 *     """
 *     cdef int refOffset = 0             # <<<<<<<<<<<<<<
 *     cdef int readOffset = 0
 *     cdef int readStart = pRead.pos
 */
  __pyx_v_refOffset = 0;

  /* "vcfutils.pyx":966
 *     """
 *     cdef int refOffset = 0
 *     cdef int readOffset = 0             # <<<<<<<<<<<<<<
 *     cdef int readStart = pRead.pos
 *     cdef int match = 0
 */
  __pyx_v_readOffset = 0;

  /* "vcfutils.pyx":967
 *     cdef int refOffset = 0
 *     cdef int readOffset = 0
 *     cdef int readStart = pRead.pos             # <<<<<<<<<<<<<<
 *     cdef int match = 0
 *     cdef int cigarIndex = 0
 */
  __pyx_t_1 = __pyx_v_pRead->pos;
  __pyx_v_readStart = __pyx_t_1;

  /* "vcfutils.pyx":968
 *     cdef int readOffset = 0
 *     cdef int readStart = pRead.pos
 *     cdef int match = 0             # <<<<<<<<<<<<<<
 *     cdef int cigarIndex = 0
 *     cdef int cigarLength = pRead.cigarLen
 */
  __pyx_v_match = 0;

  /* "vcfutils.pyx":969
 *     cdef int readStart = pRead.pos
 *     cdef int match = 0
 *     cdef int cigarIndex = 0             # <<<<<<<<<<<<<<
 *     cdef int cigarLength = pRead.cigarLen
 *     cdef int flag = 0
 */
  __pyx_v_cigarIndex = 0;

  /* "vcfutils.pyx":970
 *     cdef int match = 0
 *     cdef int cigarIndex = 0
 *     cdef int cigarLength = pRead.cigarLen             # <<<<<<<<<<<<<<
 *     cdef int flag = 0
 *     cdef int length = 0
 */
  __pyx_t_2 = __pyx_v_pRead->cigarLen;
  __pyx_v_cigarLength = __pyx_t_2;

  /* "vcfutils.pyx":971
 *     cdef int cigarIndex = 0
 *     cdef int cigarLength = pRead.cigarLen
 *     cdef int flag = 0             # <<<<<<<<<<<<<<
 *     cdef int length = 0
 *     cdef int startPosOfVarInRead = 0
 */
  __pyx_v_flag = 0;

  /* "vcfutils.pyx":972
 *     cdef int cigarLength = pRead.cigarLen
 *     cdef int flag = 0
 *     cdef int length = 0             # <<<<<<<<<<<<<<
 *     cdef int startPosOfVarInRead = 0
 *     cdef int varPos = variant.refPos
 */
  __pyx_v_length = 0;

  /* "vcfutils.pyx":973
 *     cdef int flag = 0
 *     cdef int length = 0
 *     cdef int startPosOfVarInRead = 0             # <<<<<<<<<<<<<<
 *     cdef int varPos = variant.refPos
 *     cdef int lenVarAdded = variant.nAdded
 */
  __pyx_v_startPosOfVarInRead = 0;

  /* "vcfutils.pyx":974
 *     cdef int length = 0
 *     cdef int startPosOfVarInRead = 0
 *     cdef int varPos = variant.refPos             # <<<<<<<<<<<<<<
 *     cdef int lenVarAdded = variant.nAdded
 *     cdef int lenVarRemoved = variant.nRemoved
 */
  __pyx_t_1 = __pyx_v_variant->refPos;
  __pyx_v_varPos = __pyx_t_1;

  /* "vcfutils.pyx":975
 *     cdef int startPosOfVarInRead = 0
 *     cdef int varPos = variant.refPos
 *     cdef int lenVarAdded = variant.nAdded             # <<<<<<<<<<<<<<
 *     cdef int lenVarRemoved = variant.nRemoved
 *     cdef char* varAdded = variant.added
 */
  __pyx_t_1 = __pyx_v_variant->nAdded;
  __pyx_v_lenVarAdded = __pyx_t_1;

  /* "vcfutils.pyx":976
 *     cdef int varPos = variant.refPos
 *     cdef int lenVarAdded = variant.nAdded
 *     cdef int lenVarRemoved = variant.nRemoved             # <<<<<<<<<<<<<<
 *     cdef char* varAdded = variant.added
 *     cdef char* varRemoved = variant.removed
 */
  __pyx_t_1 = __pyx_v_variant->nRemoved;
  __pyx_v_lenVarRemoved = __pyx_t_1;

  /* "vcfutils.pyx":977
 *     cdef int lenVarAdded = variant.nAdded
 *     cdef int lenVarRemoved = variant.nRemoved
 *     cdef char* varAdded = variant.added             # <<<<<<<<<<<<<<
 *     cdef char* varRemoved = variant.removed
 * 
 */
  if (unlikely(__pyx_v_variant->added == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 977, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_variant->added); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 977, __pyx_L1_error)
  __pyx_v_varAdded = __pyx_t_3;

  /* "vcfutils.pyx":978
 *     cdef int lenVarRemoved = variant.nRemoved
 *     cdef char* varAdded = variant.added
 *     cdef char* varRemoved = variant.removed             # <<<<<<<<<<<<<<
 * 
 *     for cigarIndex from 0 <= cigarIndex < cigarLength:
 */
  if (unlikely(__pyx_v_variant->removed == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 978, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsWritableString(__pyx_v_variant->removed); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L1_error)
  __pyx_v_varRemoved = __pyx_t_3;

  /* "vcfutils.pyx":980
 *     cdef char* varRemoved = variant.removed
 * 
 *     for cigarIndex from 0 <= cigarIndex < cigarLength:             # <<<<<<<<<<<<<<
 * 
 *         flag = pRead.cigarOps[2*cigarIndex]
 */
  __pyx_t_1 = __pyx_v_cigarLength;
  for (__pyx_v_cigarIndex = 0; __pyx_v_cigarIndex < __pyx_t_1; __pyx_v_cigarIndex++) {

    /* "vcfutils.pyx":982
 *     for cigarIndex from 0 <= cigarIndex < cigarLength:
 * 
 *         flag = pRead.cigarOps[2*cigarIndex]             # <<<<<<<<<<<<<<
 *         length = pRead.cigarOps[2*cigarIndex+1]
 * 
 */
    __pyx_v_flag = (__pyx_v_pRead->cigarOps[(2 * __pyx_v_cigarIndex)]);

    /* "vcfutils.pyx":983
 * 
 *         flag = pRead.cigarOps[2*cigarIndex]
 *         length = pRead.cigarOps[2*cigarIndex+1]             # <<<<<<<<<<<<<<
 * 
 *         # An insertion take us further along the read, but not the reference
 */
    __pyx_v_length = (__pyx_v_pRead->cigarOps[((2 * __pyx_v_cigarIndex) + 1)]);

    /* "vcfutils.pyx":986
 * 
 *         # An insertion take us further along the read, but not the reference
 *         if flag == CIGAR_I:             # <<<<<<<<<<<<<<
 *             startPosOfVarInRead = readOffset
 * 
 */
    __pyx_t_4 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_I) != 0);
    if (__pyx_t_4) {

      /* "vcfutils.pyx":987
 *         # An insertion take us further along the read, but not the reference
 *         if flag == CIGAR_I:
 *             startPosOfVarInRead = readOffset             # <<<<<<<<<<<<<<
 * 
 *             # Read overlaps variant site and has an insertion.
 */
      __pyx_v_startPosOfVarInRead = __pyx_v_readOffset;

      /* "vcfutils.pyx":990
 * 
 *             # Read overlaps variant site and has an insertion.
 *             if lenVarAdded != lenVarRemoved:             # <<<<<<<<<<<<<<
 * 
 *                 # Are we looking for exact matches?
 */
      __pyx_t_4 = ((__pyx_v_lenVarAdded != __pyx_v_lenVarRemoved) != 0);
      if (__pyx_t_4) {

        /* "vcfutils.pyx":993
 * 
 *                 # Are we looking for exact matches?
 *                 if countOnlyExactIndelMatches:             # <<<<<<<<<<<<<<
 *                     # Want exact length match
 *                     if variant.nAdded - variant.nRemoved == length:
 */
        __pyx_t_4 = (__pyx_v_countOnlyExactIndelMatches != 0);
        if (__pyx_t_4) {

          /* "vcfutils.pyx":995
 *                 if countOnlyExactIndelMatches:
 *                     # Want exact length match
 *                     if variant.nAdded - variant.nRemoved == length:             # <<<<<<<<<<<<<<
 *                         # And exact sequence match
 *                         if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 */
          __pyx_t_4 = (((__pyx_v_variant->nAdded - __pyx_v_variant->nRemoved) == __pyx_v_length) != 0);
          if (__pyx_t_4) {

            /* "vcfutils.pyx":997
 *                     if variant.nAdded - variant.nRemoved == length:
 *                         # And exact sequence match
 *                         if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:             # <<<<<<<<<<<<<<
 *                             return True
 *                     # Otherwise match is not valid
 */
            __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_pRead->seq + __pyx_v_startPosOfVarInRead, (__pyx_v_startPosOfVarInRead + __pyx_v_lenVarAdded) - __pyx_v_startPosOfVarInRead); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 997, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_varAdded); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 997, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 997, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (__pyx_t_4) {

              /* "vcfutils.pyx":998
 *                         # And exact sequence match
 *                         if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 *                             return True             # <<<<<<<<<<<<<<
 *                     # Otherwise match is not valid
 *                     return False
 */
              __pyx_r = 1;
              goto __pyx_L0;

              /* "vcfutils.pyx":997
 *                     if variant.nAdded - variant.nRemoved == length:
 *                         # And exact sequence match
 *                         if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:             # <<<<<<<<<<<<<<
 *                             return True
 *                     # Otherwise match is not valid
 */
            }

            /* "vcfutils.pyx":995
 *                 if countOnlyExactIndelMatches:
 *                     # Want exact length match
 *                     if variant.nAdded - variant.nRemoved == length:             # <<<<<<<<<<<<<<
 *                         # And exact sequence match
 *                         if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 */
          }

          /* "vcfutils.pyx":1000
 *                             return True
 *                     # Otherwise match is not valid
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *                 # If not looking for exact matches then any insertion counts
 */
          __pyx_r = 0;
          goto __pyx_L0;

          /* "vcfutils.pyx":993
 * 
 *                 # Are we looking for exact matches?
 *                 if countOnlyExactIndelMatches:             # <<<<<<<<<<<<<<
 *                     # Want exact length match
 *                     if variant.nAdded - variant.nRemoved == length:
 */
        }

        /* "vcfutils.pyx":1004
 *                 # If not looking for exact matches then any insertion counts
 *                 else:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *             readOffset += length
 */
        /*else*/ {
          __pyx_r = 1;
          goto __pyx_L0;
        }

        /* "vcfutils.pyx":990
 * 
 *             # Read overlaps variant site and has an insertion.
 *             if lenVarAdded != lenVarRemoved:             # <<<<<<<<<<<<<<
 * 
 *                 # Are we looking for exact matches?
 */
      }

      /* "vcfutils.pyx":1006
 *                     return True
 * 
 *             readOffset += length             # <<<<<<<<<<<<<<
 * 
 *         elif flag == CIGAR_D:
 */
      __pyx_v_readOffset = (__pyx_v_readOffset + __pyx_v_length);

      /* "vcfutils.pyx":986
 * 
 *         # An insertion take us further along the read, but not the reference
 *         if flag == CIGAR_I:             # <<<<<<<<<<<<<<
 *             startPosOfVarInRead = readOffset
 * 
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1008
 *             readOffset += length
 * 
 *         elif flag == CIGAR_D:             # <<<<<<<<<<<<<<
 *             startPosOfVarInRead = readOffset
 * 
 */
    __pyx_t_4 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_D) != 0);
    if (__pyx_t_4) {

      /* "vcfutils.pyx":1009
 * 
 *         elif flag == CIGAR_D:
 *             startPosOfVarInRead = readOffset             # <<<<<<<<<<<<<<
 * 
 *             # Counting support if the read overlaps variant site and has an indel.
 */
      __pyx_v_startPosOfVarInRead = __pyx_v_readOffset;

      /* "vcfutils.pyx":1012
 * 
 *             # Counting support if the read overlaps variant site and has an indel.
 *             if variant.nAdded != variant.nRemoved:             # <<<<<<<<<<<<<<
 * 
 *                 # Are we looking for exact matches?
 */
      __pyx_t_4 = ((__pyx_v_variant->nAdded != __pyx_v_variant->nRemoved) != 0);
      if (__pyx_t_4) {

        /* "vcfutils.pyx":1015
 * 
 *                 # Are we looking for exact matches?
 *                 if countOnlyExactIndelMatches:             # <<<<<<<<<<<<<<
 * 
 *                     # Want exact length match
 */
        __pyx_t_4 = (__pyx_v_countOnlyExactIndelMatches != 0);
        if (__pyx_t_4) {

          /* "vcfutils.pyx":1018
 * 
 *                     # Want exact length match
 *                     if variant.nRemoved - variant.nAdded == length:             # <<<<<<<<<<<<<<
 *                         return True
 *                     # Otherwise match is not valid
 */
          __pyx_t_4 = (((__pyx_v_variant->nRemoved - __pyx_v_variant->nAdded) == __pyx_v_length) != 0);
          if (__pyx_t_4) {

            /* "vcfutils.pyx":1019
 *                     # Want exact length match
 *                     if variant.nRemoved - variant.nAdded == length:
 *                         return True             # <<<<<<<<<<<<<<
 *                     # Otherwise match is not valid
 *                     else:
 */
            __pyx_r = 1;
            goto __pyx_L0;

            /* "vcfutils.pyx":1018
 * 
 *                     # Want exact length match
 *                     if variant.nRemoved - variant.nAdded == length:             # <<<<<<<<<<<<<<
 *                         return True
 *                     # Otherwise match is not valid
 */
          }

          /* "vcfutils.pyx":1022
 *                     # Otherwise match is not valid
 *                     else:
 *                         return False             # <<<<<<<<<<<<<<
 * 
 *                 # If not looking for exact matches then any deletion counts
 */
          /*else*/ {
            __pyx_r = 0;
            goto __pyx_L0;
          }

          /* "vcfutils.pyx":1015
 * 
 *                 # Are we looking for exact matches?
 *                 if countOnlyExactIndelMatches:             # <<<<<<<<<<<<<<
 * 
 *                     # Want exact length match
 */
        }

        /* "vcfutils.pyx":1026
 *                 # If not looking for exact matches then any deletion counts
 *                 else:
 *                     return True             # <<<<<<<<<<<<<<
 * 
 *             refOffset += length
 */
        /*else*/ {
          __pyx_r = 1;
          goto __pyx_L0;
        }

        /* "vcfutils.pyx":1012
 * 
 *             # Counting support if the read overlaps variant site and has an indel.
 *             if variant.nAdded != variant.nRemoved:             # <<<<<<<<<<<<<<
 * 
 *                 # Are we looking for exact matches?
 */
      }

      /* "vcfutils.pyx":1028
 *                     return True
 * 
 *             refOffset += length             # <<<<<<<<<<<<<<
 * 
 *         # A match take us further along the reference and the read
 */
      __pyx_v_refOffset = (__pyx_v_refOffset + __pyx_v_length);

      /* "vcfutils.pyx":1008
 *             readOffset += length
 * 
 *         elif flag == CIGAR_D:             # <<<<<<<<<<<<<<
 *             startPosOfVarInRead = readOffset
 * 
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1031
 * 
 *         # A match take us further along the reference and the read
 *         elif flag == CIGAR_M or flag == CIGAR_EQ or flag == CIGAR_X:             # <<<<<<<<<<<<<<
 * 
 *             # Check if read base matches variant
 */
    __pyx_t_7 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_M) != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_4 = __pyx_t_7;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_7 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_EQ) != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_4 = __pyx_t_7;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_7 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_X) != 0);
    __pyx_t_4 = __pyx_t_7;
    __pyx_L13_bool_binop_done:;
    if (__pyx_t_4) {

      /* "vcfutils.pyx":1037
 *             # If there are no insertions/deletions, then the variant position in the read is just the reference
 *             # position - the start position of the read.
 *             startPosOfVarInRead = varPos - readStart             # <<<<<<<<<<<<<<
 * 
 *             # An insertion before the variant means that it will occur later in the read by insertionSize
 */
      __pyx_v_startPosOfVarInRead = (__pyx_v_varPos - __pyx_v_readStart);

      /* "vcfutils.pyx":1040
 * 
 *             # An insertion before the variant means that it will occur later in the read by insertionSize
 *             startPosOfVarInRead += readOffset             # <<<<<<<<<<<<<<
 * 
 *             # A deletion before the variant means that it will occur earlier in the read by deletion Size
 */
      __pyx_v_startPosOfVarInRead = (__pyx_v_startPosOfVarInRead + __pyx_v_readOffset);

      /* "vcfutils.pyx":1043
 * 
 *             # A deletion before the variant means that it will occur earlier in the read by deletion Size
 *             startPosOfVarInRead -= refOffset             # <<<<<<<<<<<<<<
 *             #logger.info("Read start = %s. var pos = %s. read seq = %s. var added = %s" %(readStart, varPos, pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded], varAdded))
 * 
 */
      __pyx_v_startPosOfVarInRead = (__pyx_v_startPosOfVarInRead - __pyx_v_refOffset);

      /* "vcfutils.pyx":1046
 *             #logger.info("Read start = %s. var pos = %s. read seq = %s. var added = %s" %(readStart, varPos, pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded], varAdded))
 * 
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:             # <<<<<<<<<<<<<<
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 */
      __pyx_t_7 = (((__pyx_v_refOffset + __pyx_v_readStart) <= __pyx_v_varPos) != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_4 = __pyx_t_7;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_7 = ((((__pyx_v_refOffset + __pyx_v_readStart) + __pyx_v_length) > __pyx_v_varPos) != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_4 = __pyx_t_7;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_7 = ((__pyx_v_lenVarAdded == __pyx_v_lenVarRemoved) != 0);
      __pyx_t_4 = __pyx_t_7;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_4) {

        /* "vcfutils.pyx":1047
 * 
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:             # <<<<<<<<<<<<<<
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 *                         return True
 */
        __pyx_t_4 = (((__pyx_v_startPosOfVarInRead + __pyx_v_lenVarAdded) <= __pyx_v_pRead->rlen) != 0);
        if (__pyx_t_4) {

          /* "vcfutils.pyx":1048
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:             # <<<<<<<<<<<<<<
 *                         return True
 * 
 */
          __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_pRead->seq + __pyx_v_startPosOfVarInRead, (__pyx_v_startPosOfVarInRead + __pyx_v_lenVarAdded) - __pyx_v_startPosOfVarInRead); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_varAdded); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1048, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = (__Pyx_PyBytes_Equals(__pyx_t_6, __pyx_t_5, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1048, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (__pyx_t_4) {

            /* "vcfutils.pyx":1049
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 *                         return True             # <<<<<<<<<<<<<<
 * 
 *             readOffset += length
 */
            __pyx_r = 1;
            goto __pyx_L0;

            /* "vcfutils.pyx":1048
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:             # <<<<<<<<<<<<<<
 *                         return True
 * 
 */
          }

          /* "vcfutils.pyx":1047
 * 
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:             # <<<<<<<<<<<<<<
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 *                         return True
 */
        }

        /* "vcfutils.pyx":1046
 *             #logger.info("Read start = %s. var pos = %s. read seq = %s. var added = %s" %(readStart, varPos, pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded], varAdded))
 * 
 *             if refOffset + readStart <= varPos and refOffset + readStart + length > varPos and lenVarAdded == lenVarRemoved:             # <<<<<<<<<<<<<<
 *                 if startPosOfVarInRead + lenVarAdded <= pRead.rlen:
 *                     if pRead.seq[startPosOfVarInRead:startPosOfVarInRead+lenVarAdded] == varAdded:
 */
      }

      /* "vcfutils.pyx":1051
 *                         return True
 * 
 *             readOffset += length             # <<<<<<<<<<<<<<
 *             refOffset += length
 * 
 */
      __pyx_v_readOffset = (__pyx_v_readOffset + __pyx_v_length);

      /* "vcfutils.pyx":1052
 * 
 *             readOffset += length
 *             refOffset += length             # <<<<<<<<<<<<<<
 * 
 *         # Skipped region from the reference.
 */
      __pyx_v_refOffset = (__pyx_v_refOffset + __pyx_v_length);

      /* "vcfutils.pyx":1031
 * 
 *         # A match take us further along the reference and the read
 *         elif flag == CIGAR_M or flag == CIGAR_EQ or flag == CIGAR_X:             # <<<<<<<<<<<<<<
 * 
 *             # Check if read base matches variant
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1055
 * 
 *         # Skipped region from the reference.
 *         elif flag == CIGAR_N:             # <<<<<<<<<<<<<<
 *             readOffset += length
 *             refOffset += length
 */
    __pyx_t_4 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_N) != 0);
    if (__pyx_t_4) {

      /* "vcfutils.pyx":1056
 *         # Skipped region from the reference.
 *         elif flag == CIGAR_N:
 *             readOffset += length             # <<<<<<<<<<<<<<
 *             refOffset += length
 * 
 */
      __pyx_v_readOffset = (__pyx_v_readOffset + __pyx_v_length);

      /* "vcfutils.pyx":1057
 *         elif flag == CIGAR_N:
 *             readOffset += length
 *             refOffset += length             # <<<<<<<<<<<<<<
 * 
 *         # Soft clipping. Sequence is present in read, but we should ignore it.
 */
      __pyx_v_refOffset = (__pyx_v_refOffset + __pyx_v_length);

      /* "vcfutils.pyx":1055
 * 
 *         # Skipped region from the reference.
 *         elif flag == CIGAR_N:             # <<<<<<<<<<<<<<
 *             readOffset += length
 *             refOffset += length
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1060
 * 
 *         # Soft clipping. Sequence is present in read, but we should ignore it.
 *         elif flag == CIGAR_S:             # <<<<<<<<<<<<<<
 *             readOffset += length
 * 
 */
    __pyx_t_4 = ((__pyx_v_flag == __pyx_v_8vcfutils_CIGAR_S) != 0);
    if (__pyx_t_4) {

      /* "vcfutils.pyx":1061
 *         # Soft clipping. Sequence is present in read, but we should ignore it.
 *         elif flag == CIGAR_S:
 *             readOffset += length             # <<<<<<<<<<<<<<
 * 
 *             # We moved back read starts when there is soft clipping at the beginning of the read
 */
      __pyx_v_readOffset = (__pyx_v_readOffset + __pyx_v_length);

      /* "vcfutils.pyx":1064
 * 
 *             # We moved back read starts when there is soft clipping at the beginning of the read
 *             if cigarIndex == 0:             # <<<<<<<<<<<<<<
 *                 refOffset += length
 * 
 */
      __pyx_t_4 = ((__pyx_v_cigarIndex == 0) != 0);
      if (__pyx_t_4) {

        /* "vcfutils.pyx":1065
 *             # We moved back read starts when there is soft clipping at the beginning of the read
 *             if cigarIndex == 0:
 *                 refOffset += length             # <<<<<<<<<<<<<<
 * 
 *         # Other kinds of flag. including H (hard clipping) and P (padding)
 */
        __pyx_v_refOffset = (__pyx_v_refOffset + __pyx_v_length);

        /* "vcfutils.pyx":1064
 * 
 *             # We moved back read starts when there is soft clipping at the beginning of the read
 *             if cigarIndex == 0:             # <<<<<<<<<<<<<<
 *                 refOffset += length
 * 
 */
      }

      /* "vcfutils.pyx":1060
 * 
 *         # Soft clipping. Sequence is present in read, but we should ignore it.
 *         elif flag == CIGAR_S:             # <<<<<<<<<<<<<<
 *             readOffset += length
 * 
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1069
 *         # Other kinds of flag. including H (hard clipping) and P (padding)
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *     # No match found
 */
    /*else*/ {
      goto __pyx_L3_continue;
    }
    __pyx_L5:;
    __pyx_L3_continue:;
  }

  /* "vcfutils.pyx":1072
 * 
 *     # No match found
 *     return False             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "vcfutils.pyx":961
 * ###################################################################################################
 * 
 * cdef int variantSupportedByRead(cAlignedRead* pRead, int varBAMMinPos, int varBAMMaxPos, Variant variant, int countOnlyExactIndelMatches):             # <<<<<<<<<<<<<<
 *     """
 *     Return True if the specified variant is supported by the specified read
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("vcfutils.variantSupportedByRead", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1076
 * ###################################################################################################
 * 
 * cdef int computeHaplotypeScore(list genotypes):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate Haplotype Score: The number of haplotypes that a variant segregate into within the window.
 */

static int __pyx_f_8vcfutils_computeHaplotypeScore(PyObject *__pyx_v_genotypes) {
  struct __pyx_obj_9cgenotype_DiploidGenotype *__pyx_v_genotype = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap1 = 0;
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_hap2 = 0;
  PyObject *__pyx_v_hapScores = NULL;
  PyObject *__pyx_v_HapScores = NULL;
  PyObject *__pyx_v_hapScoreClusters = NULL;
  PyObject *__pyx_v_dist = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_HapScore = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("computeHaplotypeScore", 0);

  /* "vcfutils.pyx":1085
 *     cdef DiploidGenotype genotype
 *     cdef Haplotype hap1,hap2
 *     hapScores = {}             # <<<<<<<<<<<<<<
 * 
 *     for genotype in genotypes:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_hapScores = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1087
 *     hapScores = {}
 * 
 *     for genotype in genotypes:             # <<<<<<<<<<<<<<
 *         hap1 = genotype.hap1
 *         hap2 = genotype.hap2
 */
  if (unlikely(__pyx_v_genotypes == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1087, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_genotypes; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1087, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_9cgenotype_DiploidGenotype))))) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_genotype, ((struct __pyx_obj_9cgenotype_DiploidGenotype *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":1088
 * 
 *     for genotype in genotypes:
 *         hap1 = genotype.hap1             # <<<<<<<<<<<<<<
 *         hap2 = genotype.hap2
 *         hapScores[hap1] = - genotype.hap1Like
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_genotype->hap1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_hap1, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":1089
 *     for genotype in genotypes:
 *         hap1 = genotype.hap1
 *         hap2 = genotype.hap2             # <<<<<<<<<<<<<<
 *         hapScores[hap1] = - genotype.hap1Like
 *         hapScores[hap2] = - genotype.hap2Like
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_genotype->hap2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_hap2, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":1090
 *         hap1 = genotype.hap1
 *         hap2 = genotype.hap2
 *         hapScores[hap1] = - genotype.hap1Like             # <<<<<<<<<<<<<<
 *         hapScores[hap2] = - genotype.hap2Like
 * 
 */
    __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_genotype->hap1Like)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_hapScores, ((PyObject *)__pyx_v_hap1), __pyx_t_3) < 0)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1091
 *         hap2 = genotype.hap2
 *         hapScores[hap1] = - genotype.hap1Like
 *         hapScores[hap2] = - genotype.hap2Like             # <<<<<<<<<<<<<<
 * 
 *     HapScores = sorted(hapScores.values())
 */
    __pyx_t_3 = PyFloat_FromDouble((-__pyx_v_genotype->hap2Like)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_hapScores, ((PyObject *)__pyx_v_hap2), __pyx_t_3) < 0)) __PYX_ERR(0, 1091, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1087
 *     hapScores = {}
 * 
 *     for genotype in genotypes:             # <<<<<<<<<<<<<<
 *         hap1 = genotype.hap1
 *         hap2 = genotype.hap2
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1093
 *         hapScores[hap2] = - genotype.hap2Like
 * 
 *     HapScores = sorted(hapScores.values())             # <<<<<<<<<<<<<<
 *     hapScoreClusters = [[HapScores[0]]]
 *     dist = 0
 */
  __pyx_t_3 = __Pyx_PyDict_Values(__pyx_v_hapScores); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_5 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1093, __pyx_L1_error)
  __pyx_v_HapScores = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1094
 * 
 *     HapScores = sorted(hapScores.values())
 *     hapScoreClusters = [[HapScores[0]]]             # <<<<<<<<<<<<<<
 *     dist = 0
 * 
 */
  if (unlikely(__pyx_v_HapScores == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1094, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_HapScores, 0));
  __Pyx_GIVEREF(PyList_GET_ITEM(__pyx_v_HapScores, 0));
  PyList_SET_ITEM(__pyx_t_1, 0, PyList_GET_ITEM(__pyx_v_HapScores, 0));
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_hapScoreClusters = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "vcfutils.pyx":1095
 *     HapScores = sorted(hapScores.values())
 *     hapScoreClusters = [[HapScores[0]]]
 *     dist = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, len(HapScores)):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_dist = __pyx_int_0;

  /* "vcfutils.pyx":1097
 *     dist = 0
 * 
 *     for i in range(1, len(HapScores)):             # <<<<<<<<<<<<<<
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:
 */
  if (unlikely(__pyx_v_HapScores == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1097, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_HapScores); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1097, __pyx_L1_error)
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1097, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1097, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1097, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1097, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_6(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1097, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1099
 *     for i in range(1, len(HapScores)):
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:             # <<<<<<<<<<<<<<
 *            if len(hapScoreClusters) ==1:
 *               dist = HapScores[i] - HapScores[i-1]
 */
    if (unlikely(__pyx_v_HapScores == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1099, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_HapScores == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1099, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_int_20, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_8) {

      /* "vcfutils.pyx":1100
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:
 *            if len(hapScoreClusters) ==1:             # <<<<<<<<<<<<<<
 *               dist = HapScores[i] - HapScores[i-1]
 *            if len(hapScoreClusters)==2 :
 */
      __pyx_t_9 = PyList_GET_SIZE(__pyx_v_hapScoreClusters); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1100, __pyx_L1_error)
      __pyx_t_8 = ((__pyx_t_9 == 1) != 0);
      if (__pyx_t_8) {

        /* "vcfutils.pyx":1101
 *         if HapScores[i] -  HapScores[i-1] >20:
 *            if len(hapScoreClusters) ==1:
 *               dist = HapScores[i] - HapScores[i-1]             # <<<<<<<<<<<<<<
 *            if len(hapScoreClusters)==2 :
 *               break
 */
        if (unlikely(__pyx_v_HapScores == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1101, __pyx_L1_error)
        }
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (unlikely(__pyx_v_HapScores == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1101, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyInt_SubtractObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Subtract(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_dist, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "vcfutils.pyx":1100
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:
 *            if len(hapScoreClusters) ==1:             # <<<<<<<<<<<<<<
 *               dist = HapScores[i] - HapScores[i-1]
 *            if len(hapScoreClusters)==2 :
 */
      }

      /* "vcfutils.pyx":1102
 *            if len(hapScoreClusters) ==1:
 *               dist = HapScores[i] - HapScores[i-1]
 *            if len(hapScoreClusters)==2 :             # <<<<<<<<<<<<<<
 *               break
 *            hapScoreClusters.append([HapScores[i]])
 */
      __pyx_t_9 = PyList_GET_SIZE(__pyx_v_hapScoreClusters); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1102, __pyx_L1_error)
      __pyx_t_8 = ((__pyx_t_9 == 2) != 0);
      if (__pyx_t_8) {

        /* "vcfutils.pyx":1103
 *               dist = HapScores[i] - HapScores[i-1]
 *            if len(hapScoreClusters)==2 :
 *               break             # <<<<<<<<<<<<<<
 *            hapScoreClusters.append([HapScores[i]])
 * 
 */
        goto __pyx_L6_break;

        /* "vcfutils.pyx":1102
 *            if len(hapScoreClusters) ==1:
 *               dist = HapScores[i] - HapScores[i-1]
 *            if len(hapScoreClusters)==2 :             # <<<<<<<<<<<<<<
 *               break
 *            hapScoreClusters.append([HapScores[i]])
 */
      }

      /* "vcfutils.pyx":1104
 *            if len(hapScoreClusters)==2 :
 *               break
 *            hapScoreClusters.append([HapScores[i]])             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      if (unlikely(__pyx_v_HapScores == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1104, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_hapScoreClusters, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1104, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":1099
 *     for i in range(1, len(HapScores)):
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:             # <<<<<<<<<<<<<<
 *            if len(hapScoreClusters) ==1:
 *               dist = HapScores[i] - HapScores[i-1]
 */
      goto __pyx_L7;
    }

    /* "vcfutils.pyx":1107
 * 
 *         else:
 *            hapScoreClusters[-1].append(HapScores[i])             # <<<<<<<<<<<<<<
 * 
 *     HapScore = len(hapScoreClusters[0])
 */
    /*else*/ {
      __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_hapScoreClusters, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__pyx_v_HapScores == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1107, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_HapScores, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L7:;

    /* "vcfutils.pyx":1097
 *     dist = 0
 * 
 *     for i in range(1, len(HapScores)):             # <<<<<<<<<<<<<<
 * 
 *         if HapScores[i] -  HapScores[i-1] >20:
 */
  }
  __pyx_L6_break:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1109
 *            hapScoreClusters[-1].append(HapScores[i])
 * 
 *     HapScore = len(hapScoreClusters[0])             # <<<<<<<<<<<<<<
 * 
 *     if dist < 50 and dist >0:
 */
  __pyx_t_1 = PyList_GET_ITEM(__pyx_v_hapScoreClusters, 0);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_HapScore = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1111
 *     HapScore = len(hapScoreClusters[0])
 * 
 *     if dist < 50 and dist >0:             # <<<<<<<<<<<<<<
 *        HapScore += len(hapScoreClusters[1])
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_50, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_10) {
  } else {
    __pyx_t_8 = __pyx_t_10;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_dist, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __pyx_t_10;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_8) {

    /* "vcfutils.pyx":1112
 * 
 *     if dist < 50 and dist >0:
 *        HapScore += len(hapScoreClusters[1])             # <<<<<<<<<<<<<<
 * 
 *     return HapScore
 */
    __pyx_t_1 = PyList_GET_ITEM(__pyx_v_hapScoreClusters, 1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_HapScore, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_HapScore, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":1111
 *     HapScore = len(hapScoreClusters[0])
 * 
 *     if dist < 50 and dist >0:             # <<<<<<<<<<<<<<
 *        HapScore += len(hapScoreClusters[1])
 * 
 */
  }

  /* "vcfutils.pyx":1114
 *        HapScore += len(hapScoreClusters[1])
 * 
 *     return HapScore             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_HapScore); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1114, __pyx_L1_error)
  __pyx_r = __pyx_t_11;
  goto __pyx_L0;

  /* "vcfutils.pyx":1076
 * ###################################################################################################
 * 
 * cdef int computeHaplotypeScore(list genotypes):             # <<<<<<<<<<<<<<
 *     """
 *     Calculate Haplotype Score: The number of haplotypes that a variant segregate into within the window.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("vcfutils.computeHaplotypeScore", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_genotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap1);
  __Pyx_XDECREF((PyObject *)__pyx_v_hap2);
  __Pyx_XDECREF(__pyx_v_hapScores);
  __Pyx_XDECREF(__pyx_v_HapScores);
  __Pyx_XDECREF(__pyx_v_hapScoreClusters);
  __Pyx_XDECREF(__pyx_v_dist);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_HapScore);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1118
 * ###################################################################################################
 * 
 * cdef dict getHaplotypeInfo(list haplotypes, dict variantPosteriors, double* haplotypeFrequencies, int nHaplotypes):             # <<<<<<<<<<<<<<
 *     """
 *     Some info is computed at the haplotype level. Sort this
 */

static PyObject *__pyx_f_8vcfutils_getHaplotypeInfo(PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_variantPosteriors, double *__pyx_v_haplotypeFrequencies, int __pyx_v_nHaplotypes) {
  struct __pyx_obj_10chaplotype_Haplotype *__pyx_v_haplotype = 0;
  struct __pyx_obj_7variant_Variant *__pyx_v_var = 0;
  int __pyx_v_hapIndex;
  PyObject *__pyx_v_INFO = 0;
  PyObject *__pyx_v_PP = 0;
  double __pyx_v_FR;
  double __pyx_v_posteriorProbThisVar;
  PyObject *__pyx_v_hapINFO = NULL;
  PyObject *__pyx_v_value = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  __Pyx_RefNannySetupContext("getHaplotypeInfo", 0);

  /* "vcfutils.pyx":1125
 *     cdef Haplotype haplotype
 *     cdef Variant var
 *     cdef int hapIndex = 0             # <<<<<<<<<<<<<<
 *     cdef dict hapInfo
 *     cdef dict INFO = {}
 */
  __pyx_v_hapIndex = 0;

  /* "vcfutils.pyx":1127
 *     cdef int hapIndex = 0
 *     cdef dict hapInfo
 *     cdef dict INFO = {}             # <<<<<<<<<<<<<<
 *     cdef str PP
 *     cdef double FR = 0.0
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_INFO = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1129
 *     cdef dict INFO = {}
 *     cdef str PP
 *     cdef double FR = 0.0             # <<<<<<<<<<<<<<
 *     cdef double posteriorProbThisVar
 * 
 */
  __pyx_v_FR = 0.0;

  /* "vcfutils.pyx":1133
 * 
 *     # Start INFO calculations
 *     for hapIndex from 0 <= hapIndex < nHaplotypes:             # <<<<<<<<<<<<<<
 * 
 *         haplotype = haplotypes[hapIndex]
 */
  __pyx_t_2 = __pyx_v_nHaplotypes;
  for (__pyx_v_hapIndex = 0; __pyx_v_hapIndex < __pyx_t_2; __pyx_v_hapIndex++) {

    /* "vcfutils.pyx":1135
 *     for hapIndex from 0 <= hapIndex < nHaplotypes:
 * 
 *         haplotype = haplotypes[hapIndex]             # <<<<<<<<<<<<<<
 *         hapINFO = haplotype.vcfINFO()
 * 
 */
    if (unlikely(__pyx_v_haplotypes == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1135, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_haplotypes, __pyx_v_hapIndex, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_10chaplotype_Haplotype))))) __PYX_ERR(0, 1135, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_haplotype, ((struct __pyx_obj_10chaplotype_Haplotype *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":1136
 * 
 *         haplotype = haplotypes[hapIndex]
 *         hapINFO = haplotype.vcfINFO()             # <<<<<<<<<<<<<<
 * 
 *         for var,value in hapINFO.iteritems():
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_10chaplotype_Haplotype *)__pyx_v_haplotype->__pyx_vtab)->vcfINFO(__pyx_v_haplotype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_hapINFO, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "vcfutils.pyx":1138
 *         hapINFO = haplotype.vcfINFO()
 * 
 *         for var,value in hapINFO.iteritems():             # <<<<<<<<<<<<<<
 * 
 *             # Skip low-posterior variants
 */
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_hapINFO == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
      __PYX_ERR(0, 1138, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_hapINFO, 1, __pyx_n_s_iteritems, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 1138, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_var, ((struct __pyx_obj_7variant_Variant *)__pyx_t_6));
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "vcfutils.pyx":1141
 * 
 *             # Skip low-posterior variants
 *             if var not in variantPosteriors:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      if (unlikely(__pyx_v_variantPosteriors == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 1141, __pyx_L1_error)
      }
      __pyx_t_9 = (__Pyx_PyDict_ContainsTF(((PyObject *)__pyx_v_var), __pyx_v_variantPosteriors, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1141, __pyx_L1_error)
      __pyx_t_10 = (__pyx_t_9 != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1142
 *             # Skip low-posterior variants
 *             if var not in variantPosteriors:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if var not in INFO:
 */
        goto __pyx_L5_continue;

        /* "vcfutils.pyx":1141
 * 
 *             # Skip low-posterior variants
 *             if var not in variantPosteriors:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      }

      /* "vcfutils.pyx":1144
 *                 continue
 * 
 *             if var not in INFO:             # <<<<<<<<<<<<<<
 *                 posteriorProbThisVar = variantPosteriors[var]
 *                 PP = "%.0f" %(posteriorProbThisVar)
 */
      __pyx_t_10 = (__Pyx_PyDict_ContainsTF(((PyObject *)__pyx_v_var), __pyx_v_INFO, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __pyx_t_9 = (__pyx_t_10 != 0);
      if (__pyx_t_9) {

        /* "vcfutils.pyx":1145
 * 
 *             if var not in INFO:
 *                 posteriorProbThisVar = variantPosteriors[var]             # <<<<<<<<<<<<<<
 *                 PP = "%.0f" %(posteriorProbThisVar)
 *                 FR = haplotypeFrequencies[hapIndex]
 */
        if (unlikely(__pyx_v_variantPosteriors == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1145, __pyx_L1_error)
        }
        __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_variantPosteriors, ((PyObject *)__pyx_v_var)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1145, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1145, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_posteriorProbThisVar = __pyx_t_11;

        /* "vcfutils.pyx":1146
 *             if var not in INFO:
 *                 posteriorProbThisVar = variantPosteriors[var]
 *                 PP = "%.0f" %(posteriorProbThisVar)             # <<<<<<<<<<<<<<
 *                 FR = haplotypeFrequencies[hapIndex]
 *                 INFO[var] = dict(HP=value['HP'], PP=[PP], FR=[FR], SC=value['SC'])
 */
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_posteriorProbThisVar); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_0f, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1146, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_PP, ((PyObject*)__pyx_t_6));
        __pyx_t_6 = 0;

        /* "vcfutils.pyx":1147
 *                 posteriorProbThisVar = variantPosteriors[var]
 *                 PP = "%.0f" %(posteriorProbThisVar)
 *                 FR = haplotypeFrequencies[hapIndex]             # <<<<<<<<<<<<<<
 *                 INFO[var] = dict(HP=value['HP'], PP=[PP], FR=[FR], SC=value['SC'])
 *             else:
 */
        __pyx_v_FR = (__pyx_v_haplotypeFrequencies[__pyx_v_hapIndex]);

        /* "vcfutils.pyx":1148
 *                 PP = "%.0f" %(posteriorProbThisVar)
 *                 FR = haplotypeFrequencies[hapIndex]
 *                 INFO[var] = dict(HP=value['HP'], PP=[PP], FR=[FR], SC=value['SC'])             # <<<<<<<<<<<<<<
 *             else:
 *                 INFO[var]['FR'][0] += haplotypeFrequencies[hapIndex]
 */
        __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_value, __pyx_n_s_HP); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_HP, __pyx_t_7) < 0) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_PP);
        __Pyx_GIVEREF(__pyx_v_PP);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_PP);
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_PP, __pyx_t_7) < 0) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_FR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_7);
        PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_7);
        __pyx_t_7 = 0;
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_FR, __pyx_t_12) < 0) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_v_value, __pyx_n_s_SC); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_SC, __pyx_t_12) < 0) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_var), __pyx_t_6) < 0)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

        /* "vcfutils.pyx":1144
 *                 continue
 * 
 *             if var not in INFO:             # <<<<<<<<<<<<<<
 *                 posteriorProbThisVar = variantPosteriors[var]
 *                 PP = "%.0f" %(posteriorProbThisVar)
 */
        goto __pyx_L8;
      }

      /* "vcfutils.pyx":1150
 *                 INFO[var] = dict(HP=value['HP'], PP=[PP], FR=[FR], SC=value['SC'])
 *             else:
 *                 INFO[var]['FR'][0] += haplotypeFrequencies[hapIndex]             # <<<<<<<<<<<<<<
 * 
 *     return INFO
 */
      /*else*/ {
        __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_var)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_12 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_s_FR); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = 0;
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_12, __pyx_t_13, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyFloat_FromDouble((__pyx_v_haplotypeFrequencies[__pyx_v_hapIndex])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(__Pyx_SetItemInt(__pyx_t_12, __pyx_t_13, __pyx_t_14, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 0) < 0)) __PYX_ERR(0, 1150, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __pyx_L8:;
      __pyx_L5_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "vcfutils.pyx":1152
 *                 INFO[var]['FR'][0] += haplotypeFrequencies[hapIndex]
 * 
 *     return INFO             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_INFO);
  __pyx_r = __pyx_v_INFO;
  goto __pyx_L0;

  /* "vcfutils.pyx":1118
 * ###################################################################################################
 * 
 * cdef dict getHaplotypeInfo(list haplotypes, dict variantPosteriors, double* haplotypeFrequencies, int nHaplotypes):             # <<<<<<<<<<<<<<
 *     """
 *     Some info is computed at the haplotype level. Sort this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("vcfutils.getHaplotypeInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_haplotype);
  __Pyx_XDECREF((PyObject *)__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_INFO);
  __Pyx_XDECREF(__pyx_v_PP);
  __Pyx_XDECREF(__pyx_v_hapINFO);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1156
 * ###################################################################################################
 * 
 * cdef double computeAlleleBiasPValue(int totalReads, int variantReads):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return allele-bias p-value
 */

static double __pyx_f_8vcfutils_computeAlleleBiasPValue(int __pyx_v_totalReads, int __pyx_v_variantReads) {
  double __pyx_v_pValue;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  double __pyx_t_3;
  double __pyx_t_4;
  double __pyx_t_5;
  __Pyx_RefNannySetupContext("computeAlleleBiasPValue", 0);

  /* "vcfutils.pyx":1160
 *     Compute and return allele-bias p-value
 *     """
 *     cdef double pValue = 0.0             # <<<<<<<<<<<<<<
 * 
 *     # Frequency is higher than het.
 */
  __pyx_v_pValue = 0.0;

  /* "vcfutils.pyx":1163
 * 
 *     # Frequency is higher than het.
 *     if totalReads > 0 and <double>variantReads / <double>(totalReads) >= 0.5:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  __pyx_t_2 = ((__pyx_v_totalReads > 0) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (((((double)__pyx_v_variantReads) / ((double)__pyx_v_totalReads)) >= 0.5) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "vcfutils.pyx":1164
 *     # Frequency is higher than het.
 *     if totalReads > 0 and <double>variantReads / <double>(totalReads) >= 0.5:
 *         return 1.0             # <<<<<<<<<<<<<<
 * 
 *     # No reads touching variant
 */
    __pyx_r = 1.0;
    goto __pyx_L0;

    /* "vcfutils.pyx":1163
 * 
 *     # Frequency is higher than het.
 *     if totalReads > 0 and <double>variantReads / <double>(totalReads) >= 0.5:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  }

  /* "vcfutils.pyx":1167
 * 
 *     # No reads touching variant
 *     elif totalReads == 0:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  __pyx_t_1 = ((__pyx_v_totalReads == 0) != 0);
  if (__pyx_t_1) {

    /* "vcfutils.pyx":1168
 *     # No reads touching variant
 *     elif totalReads == 0:
 *         return 1.0             # <<<<<<<<<<<<<<
 * 
 *     # Compare total variant reads to total coverage, and computed frequency
 */
    __pyx_r = 1.0;
    goto __pyx_L0;

    /* "vcfutils.pyx":1167
 * 
 *     # No reads touching variant
 *     elif totalReads == 0:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  }

  /* "vcfutils.pyx":1172
 *     # Compare total variant reads to total coverage, and computed frequency
 *     else:
 *         pValue = betaBinomialCDF(variantReads, totalReads, 20, 20)             # <<<<<<<<<<<<<<
 *         return min(pValue, 1.0-pValue)
 * 
 */
  /*else*/ {
    __pyx_v_pValue = __pyx_f_13platypusutils_betaBinomialCDF(__pyx_v_variantReads, __pyx_v_totalReads, 20, 20);

    /* "vcfutils.pyx":1173
 *     else:
 *         pValue = betaBinomialCDF(variantReads, totalReads, 20, 20)
 *         return min(pValue, 1.0-pValue)             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
    __pyx_t_3 = (1.0 - __pyx_v_pValue);
    __pyx_t_4 = __pyx_v_pValue;
    if (((__pyx_t_3 < __pyx_t_4) != 0)) {
      __pyx_t_5 = __pyx_t_3;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    __pyx_r = __pyx_t_5;
    goto __pyx_L0;
  }

  /* "vcfutils.pyx":1156
 * ###################################################################################################
 * 
 * cdef double computeAlleleBiasPValue(int totalReads, int variantReads):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return allele-bias p-value
 */

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

/* "vcfutils.pyx":1177
 * ###################################################################################################
 * 
 * cdef double computeStrandBiasPValue(int nFwdReads, int nRevReads, int nFwdVarReads, int nRevVarReads):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return a binomial p-value for the number of reads supporting a
 */

static double __pyx_f_8vcfutils_computeStrandBiasPValue(int __pyx_v_nFwdReads, int __pyx_v_nRevReads, int __pyx_v_nFwdVarReads, int __pyx_v_nRevVarReads) {
  int __pyx_v_alpha;
  int __pyx_v_beta;
  double __pyx_v_pVal;
  double __pyx_v_freq;
  int __pyx_v_useForward;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("computeStrandBiasPValue", 0);

  /* "vcfutils.pyx":1182
 *     variant on the forward/reverse strand.
 *     """
 *     cdef int alpha = 0             # <<<<<<<<<<<<<<
 *     cdef int beta = 0
 *     cdef double pVal = 0.0
 */
  __pyx_v_alpha = 0;

  /* "vcfutils.pyx":1183
 *     """
 *     cdef int alpha = 0
 *     cdef int beta = 0             # <<<<<<<<<<<<<<
 *     cdef double pVal = 0.0
 *     cdef double freq = 0.0
 */
  __pyx_v_beta = 0;

  /* "vcfutils.pyx":1184
 *     cdef int alpha = 0
 *     cdef int beta = 0
 *     cdef double pVal = 0.0             # <<<<<<<<<<<<<<
 *     cdef double freq = 0.0
 *     cdef int useForward = True
 */
  __pyx_v_pVal = 0.0;

  /* "vcfutils.pyx":1185
 *     cdef int beta = 0
 *     cdef double pVal = 0.0
 *     cdef double freq = 0.0             # <<<<<<<<<<<<<<
 *     cdef int useForward = True
 * 
 */
  __pyx_v_freq = 0.0;

  /* "vcfutils.pyx":1186
 *     cdef double pVal = 0.0
 *     cdef double freq = 0.0
 *     cdef int useForward = True             # <<<<<<<<<<<<<<
 * 
 *     if nFwdReads == 0 or nRevReads == 0:
 */
  __pyx_v_useForward = 1;

  /* "vcfutils.pyx":1188
 *     cdef int useForward = True
 * 
 *     if nFwdReads == 0 or nRevReads == 0:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  __pyx_t_2 = ((__pyx_v_nFwdReads == 0) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_nRevReads == 0) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "vcfutils.pyx":1189
 * 
 *     if nFwdReads == 0 or nRevReads == 0:
 *         return 1.0             # <<<<<<<<<<<<<<
 * 
 *     if nFwdReads < nRevReads:
 */
    __pyx_r = 1.0;
    goto __pyx_L0;

    /* "vcfutils.pyx":1188
 *     cdef int useForward = True
 * 
 *     if nFwdReads == 0 or nRevReads == 0:             # <<<<<<<<<<<<<<
 *         return 1.0
 * 
 */
  }

  /* "vcfutils.pyx":1191
 *         return 1.0
 * 
 *     if nFwdReads < nRevReads:             # <<<<<<<<<<<<<<
 *         useForward = False
 * 
 */
  __pyx_t_1 = ((__pyx_v_nFwdReads < __pyx_v_nRevReads) != 0);
  if (__pyx_t_1) {

    /* "vcfutils.pyx":1192
 * 
 *     if nFwdReads < nRevReads:
 *         useForward = False             # <<<<<<<<<<<<<<
 * 
 *     if nFwdReads + nRevReads > 0 and nFwdVarReads + nRevVarReads > 0:
 */
    __pyx_v_useForward = 0;

    /* "vcfutils.pyx":1191
 *         return 1.0
 * 
 *     if nFwdReads < nRevReads:             # <<<<<<<<<<<<<<
 *         useForward = False
 * 
 */
  }

  /* "vcfutils.pyx":1194
 *         useForward = False
 * 
 *     if nFwdReads + nRevReads > 0 and nFwdVarReads + nRevVarReads > 0:             # <<<<<<<<<<<<<<
 * 
 *         if useForward:
 */
  __pyx_t_2 = (((__pyx_v_nFwdReads + __pyx_v_nRevReads) > 0) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = (((__pyx_v_nFwdVarReads + __pyx_v_nRevVarReads) > 0) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_1) {

    /* "vcfutils.pyx":1196
 *     if nFwdReads + nRevReads > 0 and nFwdVarReads + nRevVarReads > 0:
 * 
 *         if useForward:             # <<<<<<<<<<<<<<
 *             freq = <double>(nFwdReads) / <double>(nFwdReads + nRevReads)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_useForward != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":1197
 * 
 *         if useForward:
 *             freq = <double>(nFwdReads) / <double>(nFwdReads + nRevReads)             # <<<<<<<<<<<<<<
 *         else:
 *             freq = <double>(nRevReads) / <double>(nFwdReads + nRevReads)
 */
      __pyx_v_freq = (((double)__pyx_v_nFwdReads) / ((double)(__pyx_v_nFwdReads + __pyx_v_nRevReads)));

      /* "vcfutils.pyx":1196
 *     if nFwdReads + nRevReads > 0 and nFwdVarReads + nRevVarReads > 0:
 * 
 *         if useForward:             # <<<<<<<<<<<<<<
 *             freq = <double>(nFwdReads) / <double>(nFwdReads + nRevReads)
 *         else:
 */
      goto __pyx_L10;
    }

    /* "vcfutils.pyx":1199
 *             freq = <double>(nFwdReads) / <double>(nFwdReads + nRevReads)
 *         else:
 *             freq = <double>(nRevReads) / <double>(nFwdReads + nRevReads)             # <<<<<<<<<<<<<<
 * 
 *         #print "Freq = %s. nFwd = %s. nRev = %s. nVarFwd = %s. nVarRev = %s" %(freq, nFwdReads, nRevReads, nFwdVarReads, nRevVarReads)
 */
    /*else*/ {
      __pyx_v_freq = (((double)__pyx_v_nRevReads) / ((double)(__pyx_v_nFwdReads + __pyx_v_nRevReads)));
    }
    __pyx_L10:;

    /* "vcfutils.pyx":1203
 *         #print "Freq = %s. nFwd = %s. nRev = %s. nVarFwd = %s. nVarRev = %s" %(freq, nFwdReads, nRevReads, nFwdVarReads, nRevVarReads)
 * 
 *         if freq < 0.5:             # <<<<<<<<<<<<<<
 *             alpha = 20
 *             beta = int((<double>alpha)/freq - alpha)
 */
    __pyx_t_1 = ((__pyx_v_freq < 0.5) != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":1204
 * 
 *         if freq < 0.5:
 *             alpha = 20             # <<<<<<<<<<<<<<
 *             beta = int((<double>alpha)/freq - alpha)
 * 
 */
      __pyx_v_alpha = 20;

      /* "vcfutils.pyx":1205
 *         if freq < 0.5:
 *             alpha = 20
 *             beta = int((<double>alpha)/freq - alpha)             # <<<<<<<<<<<<<<
 * 
 *         elif freq > 0.5:
 */
      __pyx_v_beta = ((int)((((double)__pyx_v_alpha) / __pyx_v_freq) - __pyx_v_alpha));

      /* "vcfutils.pyx":1203
 *         #print "Freq = %s. nFwd = %s. nRev = %s. nVarFwd = %s. nVarRev = %s" %(freq, nFwdReads, nRevReads, nFwdVarReads, nRevVarReads)
 * 
 *         if freq < 0.5:             # <<<<<<<<<<<<<<
 *             alpha = 20
 *             beta = int((<double>alpha)/freq - alpha)
 */
      goto __pyx_L11;
    }

    /* "vcfutils.pyx":1207
 *             beta = int((<double>alpha)/freq - alpha)
 * 
 *         elif freq > 0.5:             # <<<<<<<<<<<<<<
 *             beta = 20
 *             alpha = int(beta*freq/(1.0-freq))
 */
    __pyx_t_1 = ((__pyx_v_freq > 0.5) != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":1208
 * 
 *         elif freq > 0.5:
 *             beta = 20             # <<<<<<<<<<<<<<
 *             alpha = int(beta*freq/(1.0-freq))
 * 
 */
      __pyx_v_beta = 20;

      /* "vcfutils.pyx":1209
 *         elif freq > 0.5:
 *             beta = 20
 *             alpha = int(beta*freq/(1.0-freq))             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_v_alpha = ((int)((__pyx_v_beta * __pyx_v_freq) / (1.0 - __pyx_v_freq)));

      /* "vcfutils.pyx":1207
 *             beta = int((<double>alpha)/freq - alpha)
 * 
 *         elif freq > 0.5:             # <<<<<<<<<<<<<<
 *             beta = 20
 *             alpha = int(beta*freq/(1.0-freq))
 */
      goto __pyx_L11;
    }

    /* "vcfutils.pyx":1212
 * 
 *         else:
 *             alpha = 20             # <<<<<<<<<<<<<<
 *             beta = 20
 * 
 */
    /*else*/ {
      __pyx_v_alpha = 20;

      /* "vcfutils.pyx":1213
 *         else:
 *             alpha = 20
 *             beta = 20             # <<<<<<<<<<<<<<
 * 
 *         if useForward:
 */
      __pyx_v_beta = 20;
    }
    __pyx_L11:;

    /* "vcfutils.pyx":1215
 *             beta = 20
 * 
 *         if useForward:             # <<<<<<<<<<<<<<
 *             pVal = betaBinomialCDF(nFwdVarReads, nFwdVarReads+nRevVarReads, alpha, beta)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_useForward != 0);
    if (__pyx_t_1) {

      /* "vcfutils.pyx":1216
 * 
 *         if useForward:
 *             pVal = betaBinomialCDF(nFwdVarReads, nFwdVarReads+nRevVarReads, alpha, beta)             # <<<<<<<<<<<<<<
 *         else:
 *             pVal = betaBinomialCDF(nRevVarReads, nFwdVarReads+nRevVarReads, alpha, beta)
 */
      __pyx_v_pVal = __pyx_f_13platypusutils_betaBinomialCDF(__pyx_v_nFwdVarReads, (__pyx_v_nFwdVarReads + __pyx_v_nRevVarReads), __pyx_v_alpha, __pyx_v_beta);

      /* "vcfutils.pyx":1215
 *             beta = 20
 * 
 *         if useForward:             # <<<<<<<<<<<<<<
 *             pVal = betaBinomialCDF(nFwdVarReads, nFwdVarReads+nRevVarReads, alpha, beta)
 *         else:
 */
      goto __pyx_L12;
    }

    /* "vcfutils.pyx":1218
 *             pVal = betaBinomialCDF(nFwdVarReads, nFwdVarReads+nRevVarReads, alpha, beta)
 *         else:
 *             pVal = betaBinomialCDF(nRevVarReads, nFwdVarReads+nRevVarReads, alpha, beta)             # <<<<<<<<<<<<<<
 * 
 *         return pVal
 */
    /*else*/ {
      __pyx_v_pVal = __pyx_f_13platypusutils_betaBinomialCDF(__pyx_v_nRevVarReads, (__pyx_v_nFwdVarReads + __pyx_v_nRevVarReads), __pyx_v_alpha, __pyx_v_beta);
    }
    __pyx_L12:;

    /* "vcfutils.pyx":1220
 *             pVal = betaBinomialCDF(nRevVarReads, nFwdVarReads+nRevVarReads, alpha, beta)
 * 
 *         return pVal             # <<<<<<<<<<<<<<
 *     else:
 *         return 1.0
 */
    __pyx_r = __pyx_v_pVal;
    goto __pyx_L0;

    /* "vcfutils.pyx":1194
 *         useForward = False
 * 
 *     if nFwdReads + nRevReads > 0 and nFwdVarReads + nRevVarReads > 0:             # <<<<<<<<<<<<<<
 * 
 *         if useForward:
 */
  }

  /* "vcfutils.pyx":1222
 *         return pVal
 *     else:
 *         return 1.0             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  /*else*/ {
    __pyx_r = 1.0;
    goto __pyx_L0;
  }

  /* "vcfutils.pyx":1177
 * ###################################################################################################
 * 
 * cdef double computeStrandBiasPValue(int nFwdReads, int nRevReads, int nFwdVarReads, int nRevVarReads):             # <<<<<<<<<<<<<<
 *     """
 *     Compute and return a binomial p-value for the number of reads supporting a
 */

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

/* "vcfutils.pyx":1226
 * ###################################################################################################
 * 
 * cdef dict vcfINFO(double* haplotypeFrequencies, dict variantPosteriors, list genotypeCalls, list genotypes, list haplotypes, list readBuffers, int nHaplotypes, options, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     INFO field for vcf output, two level dictionary of variant - info field - value
 */

static PyObject *__pyx_f_8vcfutils_vcfINFO(double *__pyx_v_haplotypeFrequencies, PyObject *__pyx_v_variantPosteriors, PyObject *__pyx_v_genotypeCalls, PyObject *__pyx_v_genotypes, PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_readBuffers, int __pyx_v_nHaplotypes, PyObject *__pyx_v_options, struct __pyx_obj_9fastafile_FastaFile *__pyx_v_refFile) {
  struct __pyx_obj_7variant_Variant *__pyx_v_variant = 0;
  PyObject *__pyx_v_nReadsPerSample = 0;
  PyObject *__pyx_v_nVarReadsPerSample = 0;
  PyObject *__pyx_v_listOfMinBaseQuals = 0;
  CYTHON_UNUSED double __pyx_v_BRF;
  int __pyx_v_badReadsWindow;
  CYTHON_UNUSED int __pyx_v_verbosity;
  CYTHON_UNUSED int __pyx_v_minMapQual;
  int __pyx_v_minBaseQual;
  int __pyx_v_nReadsThisSample;
  int __pyx_v_nVarReadsThisSample;
  int __pyx_v_nBadReads;
  int __pyx_v_nGoodReads;
  int __pyx_v_index;
  int __pyx_v_varBAMMinPos;
  int __pyx_v_varBAMMaxPos;
  int __pyx_v_TC;
  int __pyx_v_TC_bad;
  int __pyx_v_TR;
  int __pyx_v_TC_ab;
  int __pyx_v_TR_ab;
  int __pyx_v_NR_sb;
  int __pyx_v_NF_sb;
  int __pyx_v_TCR;
  int __pyx_v_TCF;
  int __pyx_v_TCR_sb;
  int __pyx_v_TCF_sb;
  int __pyx_v_minBaseQualInWindow;
  int __pyx_v_windowStart;
  int __pyx_v_windowSize;
  int __pyx_v_windowEnd;
  int __pyx_v_windowIndex;
  CYTHON_UNUSED int __pyx_v_startPosOfVarInRead;
  int __pyx_v_countOnlyExactIndelMatches;
  float __pyx_v_RMSMQ;
  int __pyx_v_varInGenotype;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_pStartRead;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_pEndRead;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_pStartBadRead;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_v_pEndBadRead;
  __pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_pRead;
  struct __pyx_obj_7cwindow_bamReadBuffer *__pyx_v_readBuffer = 0;
  int __pyx_v_HapScore;
  PyObject *__pyx_v_INFO = 0;
  CYTHON_UNUSED PyObject *__pyx_v_sortedVars = 0;
  PyObject *__pyx_v_NR = NULL;
  PyObject *__pyx_v_NF = NULL;
  PyObject *__pyx_v_genotype = NULL;
  double __pyx_v_qual;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  __pyx_t_13htslibWrapper_cAlignedRead **__pyx_t_13;
  long __pyx_t_14;
  long __pyx_t_15;
  long __pyx_t_16;
  short __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  int __pyx_t_20;
  char __pyx_t_21;
  int __pyx_t_22;
  int __pyx_t_23;
  double __pyx_t_24;
  PyObject *__pyx_t_25 = NULL;
  Py_ssize_t __pyx_t_26;
  __Pyx_RefNannySetupContext("vcfINFO", 0);

  /* "vcfutils.pyx":1233
 *     cdef list nReadsPerSample
 *     cdef list nVarReadsPerSample
 *     cdef list listOfMinBaseQuals = []             # <<<<<<<<<<<<<<
 *     cdef double BRF = 0.0
 *     cdef int badReadsWindow = options.badReadsWindow
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_listOfMinBaseQuals = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1234
 *     cdef list nVarReadsPerSample
 *     cdef list listOfMinBaseQuals = []
 *     cdef double BRF = 0.0             # <<<<<<<<<<<<<<
 *     cdef int badReadsWindow = options.badReadsWindow
 *     cdef int verbosity = options.verbosity
 */
  __pyx_v_BRF = 0.0;

  /* "vcfutils.pyx":1235
 *     cdef list listOfMinBaseQuals = []
 *     cdef double BRF = 0.0
 *     cdef int badReadsWindow = options.badReadsWindow             # <<<<<<<<<<<<<<
 *     cdef int verbosity = options.verbosity
 *     cdef int minMapQual = options.minMapQual
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_badReadsWindow); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1235, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_badReadsWindow = __pyx_t_2;

  /* "vcfutils.pyx":1236
 *     cdef double BRF = 0.0
 *     cdef int badReadsWindow = options.badReadsWindow
 *     cdef int verbosity = options.verbosity             # <<<<<<<<<<<<<<
 *     cdef int minMapQual = options.minMapQual
 *     cdef int minBaseQual = options.minBaseQual
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_verbosity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_verbosity = __pyx_t_2;

  /* "vcfutils.pyx":1237
 *     cdef int badReadsWindow = options.badReadsWindow
 *     cdef int verbosity = options.verbosity
 *     cdef int minMapQual = options.minMapQual             # <<<<<<<<<<<<<<
 *     cdef int minBaseQual = options.minBaseQual
 *     cdef int nReadsThisSample = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minMapQual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1237, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_minMapQual = __pyx_t_2;

  /* "vcfutils.pyx":1238
 *     cdef int verbosity = options.verbosity
 *     cdef int minMapQual = options.minMapQual
 *     cdef int minBaseQual = options.minBaseQual             # <<<<<<<<<<<<<<
 *     cdef int nReadsThisSample = 0
 *     cdef int nVarReadsThisSample = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_minBaseQual); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_minBaseQual = __pyx_t_2;

  /* "vcfutils.pyx":1239
 *     cdef int minMapQual = options.minMapQual
 *     cdef int minBaseQual = options.minBaseQual
 *     cdef int nReadsThisSample = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarReadsThisSample = 0
 *     cdef int nBadReads = 0
 */
  __pyx_v_nReadsThisSample = 0;

  /* "vcfutils.pyx":1240
 *     cdef int minBaseQual = options.minBaseQual
 *     cdef int nReadsThisSample = 0
 *     cdef int nVarReadsThisSample = 0             # <<<<<<<<<<<<<<
 *     cdef int nBadReads = 0
 *     cdef int nGoodReads = 0
 */
  __pyx_v_nVarReadsThisSample = 0;

  /* "vcfutils.pyx":1241
 *     cdef int nReadsThisSample = 0
 *     cdef int nVarReadsThisSample = 0
 *     cdef int nBadReads = 0             # <<<<<<<<<<<<<<
 *     cdef int nGoodReads = 0
 *     cdef int index = 0
 */
  __pyx_v_nBadReads = 0;

  /* "vcfutils.pyx":1242
 *     cdef int nVarReadsThisSample = 0
 *     cdef int nBadReads = 0
 *     cdef int nGoodReads = 0             # <<<<<<<<<<<<<<
 *     cdef int index = 0
 *     cdef int varBAMMinPos = 0
 */
  __pyx_v_nGoodReads = 0;

  /* "vcfutils.pyx":1243
 *     cdef int nBadReads = 0
 *     cdef int nGoodReads = 0
 *     cdef int index = 0             # <<<<<<<<<<<<<<
 *     cdef int varBAMMinPos = 0
 *     cdef int varBAMMaxPos = 0
 */
  __pyx_v_index = 0;

  /* "vcfutils.pyx":1244
 *     cdef int nGoodReads = 0
 *     cdef int index = 0
 *     cdef int varBAMMinPos = 0             # <<<<<<<<<<<<<<
 *     cdef int varBAMMaxPos = 0
 *     cdef int TC = 0
 */
  __pyx_v_varBAMMinPos = 0;

  /* "vcfutils.pyx":1245
 *     cdef int index = 0
 *     cdef int varBAMMinPos = 0
 *     cdef int varBAMMaxPos = 0             # <<<<<<<<<<<<<<
 *     cdef int TC = 0
 *     cdef int TC_bad = 0
 */
  __pyx_v_varBAMMaxPos = 0;

  /* "vcfutils.pyx":1246
 *     cdef int varBAMMinPos = 0
 *     cdef int varBAMMaxPos = 0
 *     cdef int TC = 0             # <<<<<<<<<<<<<<
 *     cdef int TC_bad = 0
 *     cdef int TR = 0
 */
  __pyx_v_TC = 0;

  /* "vcfutils.pyx":1247
 *     cdef int varBAMMaxPos = 0
 *     cdef int TC = 0
 *     cdef int TC_bad = 0             # <<<<<<<<<<<<<<
 *     cdef int TR = 0
 *     cdef int TC_ab = 0
 */
  __pyx_v_TC_bad = 0;

  /* "vcfutils.pyx":1248
 *     cdef int TC = 0
 *     cdef int TC_bad = 0
 *     cdef int TR = 0             # <<<<<<<<<<<<<<
 *     cdef int TC_ab = 0
 *     cdef int TR_ab = 0
 */
  __pyx_v_TR = 0;

  /* "vcfutils.pyx":1249
 *     cdef int TC_bad = 0
 *     cdef int TR = 0
 *     cdef int TC_ab = 0             # <<<<<<<<<<<<<<
 *     cdef int TR_ab = 0
 *     cdef int NR_sb = 0
 */
  __pyx_v_TC_ab = 0;

  /* "vcfutils.pyx":1250
 *     cdef int TR = 0
 *     cdef int TC_ab = 0
 *     cdef int TR_ab = 0             # <<<<<<<<<<<<<<
 *     cdef int NR_sb = 0
 *     cdef int NF_sb = 0
 */
  __pyx_v_TR_ab = 0;

  /* "vcfutils.pyx":1251
 *     cdef int TC_ab = 0
 *     cdef int TR_ab = 0
 *     cdef int NR_sb = 0             # <<<<<<<<<<<<<<
 *     cdef int NF_sb = 0
 *     cdef int TCR = 0
 */
  __pyx_v_NR_sb = 0;

  /* "vcfutils.pyx":1252
 *     cdef int TR_ab = 0
 *     cdef int NR_sb = 0
 *     cdef int NF_sb = 0             # <<<<<<<<<<<<<<
 *     cdef int TCR = 0
 *     cdef int TCF = 0
 */
  __pyx_v_NF_sb = 0;

  /* "vcfutils.pyx":1253
 *     cdef int NR_sb = 0
 *     cdef int NF_sb = 0
 *     cdef int TCR = 0             # <<<<<<<<<<<<<<
 *     cdef int TCF = 0
 *     cdef int TCR_sb = 0
 */
  __pyx_v_TCR = 0;

  /* "vcfutils.pyx":1254
 *     cdef int NF_sb = 0
 *     cdef int TCR = 0
 *     cdef int TCF = 0             # <<<<<<<<<<<<<<
 *     cdef int TCR_sb = 0
 *     cdef int TCF_sb = 0
 */
  __pyx_v_TCF = 0;

  /* "vcfutils.pyx":1255
 *     cdef int TCR = 0
 *     cdef int TCF = 0
 *     cdef int TCR_sb = 0             # <<<<<<<<<<<<<<
 *     cdef int TCF_sb = 0
 *     cdef int minBaseQualInWindow = 0
 */
  __pyx_v_TCR_sb = 0;

  /* "vcfutils.pyx":1256
 *     cdef int TCF = 0
 *     cdef int TCR_sb = 0
 *     cdef int TCF_sb = 0             # <<<<<<<<<<<<<<
 *     cdef int minBaseQualInWindow = 0
 *     cdef int windowStart = 0
 */
  __pyx_v_TCF_sb = 0;

  /* "vcfutils.pyx":1257
 *     cdef int TCR_sb = 0
 *     cdef int TCF_sb = 0
 *     cdef int minBaseQualInWindow = 0             # <<<<<<<<<<<<<<
 *     cdef int windowStart = 0
 *     cdef int windowSize = badReadsWindow
 */
  __pyx_v_minBaseQualInWindow = 0;

  /* "vcfutils.pyx":1258
 *     cdef int TCF_sb = 0
 *     cdef int minBaseQualInWindow = 0
 *     cdef int windowStart = 0             # <<<<<<<<<<<<<<
 *     cdef int windowSize = badReadsWindow
 *     cdef int windowEnd = 0
 */
  __pyx_v_windowStart = 0;

  /* "vcfutils.pyx":1259
 *     cdef int minBaseQualInWindow = 0
 *     cdef int windowStart = 0
 *     cdef int windowSize = badReadsWindow             # <<<<<<<<<<<<<<
 *     cdef int windowEnd = 0
 *     cdef int windowIndex = 0
 */
  __pyx_v_windowSize = __pyx_v_badReadsWindow;

  /* "vcfutils.pyx":1260
 *     cdef int windowStart = 0
 *     cdef int windowSize = badReadsWindow
 *     cdef int windowEnd = 0             # <<<<<<<<<<<<<<
 *     cdef int windowIndex = 0
 *     cdef int startPosOfVarInRead = 0
 */
  __pyx_v_windowEnd = 0;

  /* "vcfutils.pyx":1261
 *     cdef int windowSize = badReadsWindow
 *     cdef int windowEnd = 0
 *     cdef int windowIndex = 0             # <<<<<<<<<<<<<<
 *     cdef int startPosOfVarInRead = 0
 *     cdef int countOnlyExactIndelMatches = options.countOnlyExactIndelMatches
 */
  __pyx_v_windowIndex = 0;

  /* "vcfutils.pyx":1262
 *     cdef int windowEnd = 0
 *     cdef int windowIndex = 0
 *     cdef int startPosOfVarInRead = 0             # <<<<<<<<<<<<<<
 *     cdef int countOnlyExactIndelMatches = options.countOnlyExactIndelMatches
 *     cdef float RMSMQ = 0
 */
  __pyx_v_startPosOfVarInRead = 0;

  /* "vcfutils.pyx":1263
 *     cdef int windowIndex = 0
 *     cdef int startPosOfVarInRead = 0
 *     cdef int countOnlyExactIndelMatches = options.countOnlyExactIndelMatches             # <<<<<<<<<<<<<<
 *     cdef float RMSMQ = 0
 *     cdef bint varInGenotype = False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_countOnlyExactIndelMatches); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_countOnlyExactIndelMatches = __pyx_t_2;

  /* "vcfutils.pyx":1264
 *     cdef int startPosOfVarInRead = 0
 *     cdef int countOnlyExactIndelMatches = options.countOnlyExactIndelMatches
 *     cdef float RMSMQ = 0             # <<<<<<<<<<<<<<
 *     cdef bint varInGenotype = False
 *     cdef cAlignedRead** pStartRead
 */
  __pyx_v_RMSMQ = 0.0;

  /* "vcfutils.pyx":1265
 *     cdef int countOnlyExactIndelMatches = options.countOnlyExactIndelMatches
 *     cdef float RMSMQ = 0
 *     cdef bint varInGenotype = False             # <<<<<<<<<<<<<<
 *     cdef cAlignedRead** pStartRead
 *     cdef cAlignedRead** pEndRead
 */
  __pyx_v_varInGenotype = 0;

  /* "vcfutils.pyx":1274
 * 
 *     # Make sure to do this in the right order
 *     cdef int HapScore = computeHaplotypeScore(genotypes)             # <<<<<<<<<<<<<<
 *     cdef dict INFO = getHaplotypeInfo(haplotypes, variantPosteriors, haplotypeFrequencies, nHaplotypes)
 *     cdef list sortedVars = sorted(INFO.keys())
 */
  __pyx_v_HapScore = __pyx_f_8vcfutils_computeHaplotypeScore(__pyx_v_genotypes);

  /* "vcfutils.pyx":1275
 *     # Make sure to do this in the right order
 *     cdef int HapScore = computeHaplotypeScore(genotypes)
 *     cdef dict INFO = getHaplotypeInfo(haplotypes, variantPosteriors, haplotypeFrequencies, nHaplotypes)             # <<<<<<<<<<<<<<
 *     cdef list sortedVars = sorted(INFO.keys())
 * 
 */
  __pyx_t_1 = __pyx_f_8vcfutils_getHaplotypeInfo(__pyx_v_haplotypes, __pyx_v_variantPosteriors, __pyx_v_haplotypeFrequencies, __pyx_v_nHaplotypes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_INFO = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1276
 *     cdef int HapScore = computeHaplotypeScore(genotypes)
 *     cdef dict INFO = getHaplotypeInfo(haplotypes, variantPosteriors, haplotypeFrequencies, nHaplotypes)
 *     cdef list sortedVars = sorted(INFO.keys())             # <<<<<<<<<<<<<<
 * 
 *     for variant in INFO:
 */
  if (unlikely(__pyx_v_INFO == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys");
    __PYX_ERR(0, 1276, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_INFO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_5 = PyList_Sort(__pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1276, __pyx_L1_error)
  __pyx_v_sortedVars = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1278
 *     cdef list sortedVars = sorted(INFO.keys())
 * 
 *     for variant in INFO:             # <<<<<<<<<<<<<<
 * 
 *         listOfMinBaseQuals = []
 */
  __pyx_t_6 = 0;
  if (unlikely(__pyx_v_INFO == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1278, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_INFO, 1, ((PyObject *)NULL), (&__pyx_t_7), (&__pyx_t_2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_4;
  __pyx_t_4 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_7, &__pyx_t_6, &__pyx_t_4, NULL, NULL, __pyx_t_2);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 1278, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_variant, ((struct __pyx_obj_7variant_Variant *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1280
 *     for variant in INFO:
 * 
 *         listOfMinBaseQuals = []             # <<<<<<<<<<<<<<
 *         nReadsPerSample = []
 *         nVarReadsPerSample = []
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_listOfMinBaseQuals, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1281
 * 
 *         listOfMinBaseQuals = []
 *         nReadsPerSample = []             # <<<<<<<<<<<<<<
 *         nVarReadsPerSample = []
 *         nGoodReads = 0
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_nReadsPerSample, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1282
 *         listOfMinBaseQuals = []
 *         nReadsPerSample = []
 *         nVarReadsPerSample = []             # <<<<<<<<<<<<<<
 *         nGoodReads = 0
 *         nBadReads = 0
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_nVarReadsPerSample, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1283
 *         nReadsPerSample = []
 *         nVarReadsPerSample = []
 *         nGoodReads = 0             # <<<<<<<<<<<<<<
 *         nBadReads = 0
 *         RMSMQ = 0
 */
    __pyx_v_nGoodReads = 0;

    /* "vcfutils.pyx":1284
 *         nVarReadsPerSample = []
 *         nGoodReads = 0
 *         nBadReads = 0             # <<<<<<<<<<<<<<
 *         RMSMQ = 0
 *         TC = 0
 */
    __pyx_v_nBadReads = 0;

    /* "vcfutils.pyx":1285
 *         nGoodReads = 0
 *         nBadReads = 0
 *         RMSMQ = 0             # <<<<<<<<<<<<<<
 *         TC = 0
 *         TC_bad = 0
 */
    __pyx_v_RMSMQ = 0.0;

    /* "vcfutils.pyx":1286
 *         nBadReads = 0
 *         RMSMQ = 0
 *         TC = 0             # <<<<<<<<<<<<<<
 *         TC_bad = 0
 *         TR = 0
 */
    __pyx_v_TC = 0;

    /* "vcfutils.pyx":1287
 *         RMSMQ = 0
 *         TC = 0
 *         TC_bad = 0             # <<<<<<<<<<<<<<
 *         TR = 0
 *         TC_ab = 0
 */
    __pyx_v_TC_bad = 0;

    /* "vcfutils.pyx":1288
 *         TC = 0
 *         TC_bad = 0
 *         TR = 0             # <<<<<<<<<<<<<<
 *         TC_ab = 0
 *         TR_ab = 0
 */
    __pyx_v_TR = 0;

    /* "vcfutils.pyx":1289
 *         TC_bad = 0
 *         TR = 0
 *         TC_ab = 0             # <<<<<<<<<<<<<<
 *         TR_ab = 0
 *         TCR = 0
 */
    __pyx_v_TC_ab = 0;

    /* "vcfutils.pyx":1290
 *         TR = 0
 *         TC_ab = 0
 *         TR_ab = 0             # <<<<<<<<<<<<<<
 *         TCR = 0
 *         TCF = 0
 */
    __pyx_v_TR_ab = 0;

    /* "vcfutils.pyx":1291
 *         TC_ab = 0
 *         TR_ab = 0
 *         TCR = 0             # <<<<<<<<<<<<<<
 *         TCF = 0
 *         NR = 0
 */
    __pyx_v_TCR = 0;

    /* "vcfutils.pyx":1292
 *         TR_ab = 0
 *         TCR = 0
 *         TCF = 0             # <<<<<<<<<<<<<<
 *         NR = 0
 *         NF = 0
 */
    __pyx_v_TCF = 0;

    /* "vcfutils.pyx":1293
 *         TCR = 0
 *         TCF = 0
 *         NR = 0             # <<<<<<<<<<<<<<
 *         NF = 0
 *         NR_sb = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_NR, __pyx_int_0);

    /* "vcfutils.pyx":1294
 *         TCF = 0
 *         NR = 0
 *         NF = 0             # <<<<<<<<<<<<<<
 *         NR_sb = 0
 *         NF_sb = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_XDECREF_SET(__pyx_v_NF, __pyx_int_0);

    /* "vcfutils.pyx":1295
 *         NR = 0
 *         NF = 0
 *         NR_sb = 0             # <<<<<<<<<<<<<<
 *         NF_sb = 0
 *         TCR_sb = 0
 */
    __pyx_v_NR_sb = 0;

    /* "vcfutils.pyx":1296
 *         NF = 0
 *         NR_sb = 0
 *         NF_sb = 0             # <<<<<<<<<<<<<<
 *         TCR_sb = 0
 *         TCF_sb = 0
 */
    __pyx_v_NF_sb = 0;

    /* "vcfutils.pyx":1297
 *         NR_sb = 0
 *         NF_sb = 0
 *         TCR_sb = 0             # <<<<<<<<<<<<<<
 *         TCF_sb = 0
 *         varBAMMinPos = variant.bamMinPos
 */
    __pyx_v_TCR_sb = 0;

    /* "vcfutils.pyx":1298
 *         NF_sb = 0
 *         TCR_sb = 0
 *         TCF_sb = 0             # <<<<<<<<<<<<<<
 *         varBAMMinPos = variant.bamMinPos
 *         varBAMMaxPos = variant.bamMaxPos
 */
    __pyx_v_TCF_sb = 0;

    /* "vcfutils.pyx":1299
 *         TCR_sb = 0
 *         TCF_sb = 0
 *         varBAMMinPos = variant.bamMinPos             # <<<<<<<<<<<<<<
 *         varBAMMaxPos = variant.bamMaxPos
 * 
 */
    __pyx_t_8 = __pyx_v_variant->bamMinPos;
    __pyx_v_varBAMMinPos = __pyx_t_8;

    /* "vcfutils.pyx":1300
 *         TCF_sb = 0
 *         varBAMMinPos = variant.bamMinPos
 *         varBAMMaxPos = variant.bamMaxPos             # <<<<<<<<<<<<<<
 * 
 *         for index,genotype in enumerate(genotypeCalls):
 */
    __pyx_t_8 = __pyx_v_variant->bamMaxPos;
    __pyx_v_varBAMMaxPos = __pyx_t_8;

    /* "vcfutils.pyx":1302
 *         varBAMMaxPos = variant.bamMaxPos
 * 
 *         for index,genotype in enumerate(genotypeCalls):             # <<<<<<<<<<<<<<
 * 
 *             varInGenotype = genotype is not None and variant in genotype
 */
    __pyx_t_8 = 0;
    __pyx_t_4 = __pyx_v_genotypeCalls; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
    for (;;) {
      if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1302, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_genotype, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_v_index = __pyx_t_8;
      __pyx_t_8 = (__pyx_t_8 + 1);

      /* "vcfutils.pyx":1304
 *         for index,genotype in enumerate(genotypeCalls):
 * 
 *             varInGenotype = genotype is not None and variant in genotype             # <<<<<<<<<<<<<<
 *             readBuffer = readBuffers[index]
 *             pStartRead = readBuffer.reads.windowStart
 */
      __pyx_t_11 = (__pyx_v_genotype != Py_None);
      __pyx_t_12 = (__pyx_t_11 != 0);
      if (__pyx_t_12) {
      } else {
        __pyx_t_10 = __pyx_t_12;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_12 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_v_variant), __pyx_v_genotype, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __pyx_t_11 = (__pyx_t_12 != 0);
      __pyx_t_10 = __pyx_t_11;
      __pyx_L7_bool_binop_done:;
      __pyx_v_varInGenotype = __pyx_t_10;

      /* "vcfutils.pyx":1305
 * 
 *             varInGenotype = genotype is not None and variant in genotype
 *             readBuffer = readBuffers[index]             # <<<<<<<<<<<<<<
 *             pStartRead = readBuffer.reads.windowStart
 *             pEndRead = readBuffer.reads.windowEnd
 */
      if (unlikely(__pyx_v_readBuffers == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1305, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_readBuffers, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __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_ERR(0, 1305, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_readBuffer, ((struct __pyx_obj_7cwindow_bamReadBuffer *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "vcfutils.pyx":1306
 *             varInGenotype = genotype is not None and variant in genotype
 *             readBuffer = readBuffers[index]
 *             pStartRead = readBuffer.reads.windowStart             # <<<<<<<<<<<<<<
 *             pEndRead = readBuffer.reads.windowEnd
 *             pStartBadRead = readBuffer.badReads.windowStart
 */
      __pyx_t_13 = __pyx_v_readBuffer->reads->windowStart;
      __pyx_v_pStartRead = __pyx_t_13;

      /* "vcfutils.pyx":1307
 *             readBuffer = readBuffers[index]
 *             pStartRead = readBuffer.reads.windowStart
 *             pEndRead = readBuffer.reads.windowEnd             # <<<<<<<<<<<<<<
 *             pStartBadRead = readBuffer.badReads.windowStart
 *             pEndBadRead = readBuffer.badReads.windowEnd
 */
      __pyx_t_13 = __pyx_v_readBuffer->reads->windowEnd;
      __pyx_v_pEndRead = __pyx_t_13;

      /* "vcfutils.pyx":1308
 *             pStartRead = readBuffer.reads.windowStart
 *             pEndRead = readBuffer.reads.windowEnd
 *             pStartBadRead = readBuffer.badReads.windowStart             # <<<<<<<<<<<<<<
 *             pEndBadRead = readBuffer.badReads.windowEnd
 *             nGoodReads += (readBuffer.reads.windowEnd - readBuffer.reads.windowStart)
 */
      __pyx_t_13 = __pyx_v_readBuffer->badReads->windowStart;
      __pyx_v_pStartBadRead = __pyx_t_13;

      /* "vcfutils.pyx":1309
 *             pEndRead = readBuffer.reads.windowEnd
 *             pStartBadRead = readBuffer.badReads.windowStart
 *             pEndBadRead = readBuffer.badReads.windowEnd             # <<<<<<<<<<<<<<
 *             nGoodReads += (readBuffer.reads.windowEnd - readBuffer.reads.windowStart)
 *             nBadReads += (readBuffer.badReads.windowEnd - readBuffer.badReads.windowStart)
 */
      __pyx_t_13 = __pyx_v_readBuffer->badReads->windowEnd;
      __pyx_v_pEndBadRead = __pyx_t_13;

      /* "vcfutils.pyx":1310
 *             pStartBadRead = readBuffer.badReads.windowStart
 *             pEndBadRead = readBuffer.badReads.windowEnd
 *             nGoodReads += (readBuffer.reads.windowEnd - readBuffer.reads.windowStart)             # <<<<<<<<<<<<<<
 *             nBadReads += (readBuffer.badReads.windowEnd - readBuffer.badReads.windowStart)
 * 
 */
      __pyx_v_nGoodReads = (__pyx_v_nGoodReads + (__pyx_v_readBuffer->reads->windowEnd - __pyx_v_readBuffer->reads->windowStart));

      /* "vcfutils.pyx":1311
 *             pEndBadRead = readBuffer.badReads.windowEnd
 *             nGoodReads += (readBuffer.reads.windowEnd - readBuffer.reads.windowStart)
 *             nBadReads += (readBuffer.badReads.windowEnd - readBuffer.badReads.windowStart)             # <<<<<<<<<<<<<<
 * 
 *             nReadsThisSample = 0
 */
      __pyx_v_nBadReads = (__pyx_v_nBadReads + (__pyx_v_readBuffer->badReads->windowEnd - __pyx_v_readBuffer->badReads->windowStart));

      /* "vcfutils.pyx":1313
 *             nBadReads += (readBuffer.badReads.windowEnd - readBuffer.badReads.windowStart)
 * 
 *             nReadsThisSample = 0             # <<<<<<<<<<<<<<
 *             nVarReadsThisSample = 0
 * 
 */
      __pyx_v_nReadsThisSample = 0;

      /* "vcfutils.pyx":1314
 * 
 *             nReadsThisSample = 0
 *             nVarReadsThisSample = 0             # <<<<<<<<<<<<<<
 * 
 *             while pStartBadRead != pEndBadRead:
 */
      __pyx_v_nVarReadsThisSample = 0;

      /* "vcfutils.pyx":1316
 *             nVarReadsThisSample = 0
 * 
 *             while pStartBadRead != pEndBadRead:             # <<<<<<<<<<<<<<
 * 
 *                 pRead = pStartBadRead[0]
 */
      while (1) {
        __pyx_t_10 = ((__pyx_v_pStartBadRead != __pyx_v_pEndBadRead) != 0);
        if (!__pyx_t_10) break;

        /* "vcfutils.pyx":1318
 *             while pStartBadRead != pEndBadRead:
 * 
 *                 pRead = pStartBadRead[0]             # <<<<<<<<<<<<<<
 * 
 *                 # Does read overlap variant site
 */
        __pyx_v_pRead = (__pyx_v_pStartBadRead[0]);

        /* "vcfutils.pyx":1321
 * 
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):             # <<<<<<<<<<<<<<
 *                     pStartBadRead += 1
 *                     continue
 */
        __pyx_t_10 = ((!(__pyx_f_8vcfutils_readOverlapsVariant(__pyx_v_pRead, __pyx_v_varBAMMinPos, __pyx_v_varBAMMaxPos) != 0)) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1322
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):
 *                     pStartBadRead += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
          __pyx_v_pStartBadRead = (__pyx_v_pStartBadRead + 1);

          /* "vcfutils.pyx":1323
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):
 *                     pStartBadRead += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 # Does read have good quality across variant site
 */
          goto __pyx_L9_continue;

          /* "vcfutils.pyx":1321
 * 
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):             # <<<<<<<<<<<<<<
 *                     pStartBadRead += 1
 *                     continue
 */
        }

        /* "vcfutils.pyx":1326
 * 
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):             # <<<<<<<<<<<<<<
 *                     pStartBadRead += 1
 *                     continue
 */
        __pyx_t_10 = ((!(__pyx_f_8vcfutils_readQualIsGoodVariantPosition(__pyx_v_pRead, __pyx_v_varBAMMinPos, __pyx_v_varBAMMaxPos, __pyx_v_minBaseQual) != 0)) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1327
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):
 *                     pStartBadRead += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
          __pyx_v_pStartBadRead = (__pyx_v_pStartBadRead + 1);

          /* "vcfutils.pyx":1328
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):
 *                     pStartBadRead += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 TC_bad += 1
 */
          goto __pyx_L9_continue;

          /* "vcfutils.pyx":1326
 * 
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):             # <<<<<<<<<<<<<<
 *                     pStartBadRead += 1
 *                     continue
 */
        }

        /* "vcfutils.pyx":1330
 *                     continue
 * 
 *                 TC_bad += 1             # <<<<<<<<<<<<<<
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 *                 pStartBadRead += 1
 */
        __pyx_v_TC_bad = (__pyx_v_TC_bad + 1);

        /* "vcfutils.pyx":1331
 * 
 *                 TC_bad += 1
 *                 RMSMQ += (pRead.mapq*pRead.mapq)             # <<<<<<<<<<<<<<
 *                 pStartBadRead += 1
 * 
 */
        __pyx_v_RMSMQ = (__pyx_v_RMSMQ + (__pyx_v_pRead->mapq * __pyx_v_pRead->mapq));

        /* "vcfutils.pyx":1332
 *                 TC_bad += 1
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 *                 pStartBadRead += 1             # <<<<<<<<<<<<<<
 * 
 *             while pStartRead != pEndRead:
 */
        __pyx_v_pStartBadRead = (__pyx_v_pStartBadRead + 1);
        __pyx_L9_continue:;
      }

      /* "vcfutils.pyx":1334
 *                 pStartBadRead += 1
 * 
 *             while pStartRead != pEndRead:             # <<<<<<<<<<<<<<
 * 
 *                 pRead = pStartRead[0]
 */
      while (1) {
        __pyx_t_10 = ((__pyx_v_pStartRead != __pyx_v_pEndRead) != 0);
        if (!__pyx_t_10) break;

        /* "vcfutils.pyx":1336
 *             while pStartRead != pEndRead:
 * 
 *                 pRead = pStartRead[0]             # <<<<<<<<<<<<<<
 * 
 *                 # Does read overlap variant site
 */
        __pyx_v_pRead = (__pyx_v_pStartRead[0]);

        /* "vcfutils.pyx":1339
 * 
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):             # <<<<<<<<<<<<<<
 *                     pStartRead += 1
 *                     continue
 */
        __pyx_t_10 = ((!(__pyx_f_8vcfutils_readOverlapsVariant(__pyx_v_pRead, __pyx_v_varBAMMinPos, __pyx_v_varBAMMaxPos) != 0)) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1340
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):
 *                     pStartRead += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
          __pyx_v_pStartRead = (__pyx_v_pStartRead + 1);

          /* "vcfutils.pyx":1341
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):
 *                     pStartRead += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 # Does read have good quality across variant site
 */
          goto __pyx_L13_continue;

          /* "vcfutils.pyx":1339
 * 
 *                 # Does read overlap variant site
 *                 if not readOverlapsVariant(pRead, varBAMMinPos, varBAMMaxPos):             # <<<<<<<<<<<<<<
 *                     pStartRead += 1
 *                     continue
 */
        }

        /* "vcfutils.pyx":1344
 * 
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):             # <<<<<<<<<<<<<<
 *                     pStartRead += 1
 *                     continue
 */
        __pyx_t_10 = ((!(__pyx_f_8vcfutils_readQualIsGoodVariantPosition(__pyx_v_pRead, __pyx_v_varBAMMinPos, __pyx_v_varBAMMaxPos, __pyx_v_minBaseQual) != 0)) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1345
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):
 *                     pStartRead += 1             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
          __pyx_v_pStartRead = (__pyx_v_pStartRead + 1);

          /* "vcfutils.pyx":1346
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):
 *                     pStartRead += 1
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 nReadsThisSample += 1
 */
          goto __pyx_L13_continue;

          /* "vcfutils.pyx":1344
 * 
 *                 # Does read have good quality across variant site
 *                 if not readQualIsGoodVariantPosition(pRead, varBAMMinPos, varBAMMaxPos, minBaseQual):             # <<<<<<<<<<<<<<
 *                     pStartRead += 1
 *                     continue
 */
        }

        /* "vcfutils.pyx":1348
 *                     continue
 * 
 *                 nReadsThisSample += 1             # <<<<<<<<<<<<<<
 *                 TC += 1
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 */
        __pyx_v_nReadsThisSample = (__pyx_v_nReadsThisSample + 1);

        /* "vcfutils.pyx":1349
 * 
 *                 nReadsThisSample += 1
 *                 TC += 1             # <<<<<<<<<<<<<<
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 * 
 */
        __pyx_v_TC = (__pyx_v_TC + 1);

        /* "vcfutils.pyx":1350
 *                 nReadsThisSample += 1
 *                 TC += 1
 *                 RMSMQ += (pRead.mapq*pRead.mapq)             # <<<<<<<<<<<<<<
 * 
 *                 if varInGenotype:
 */
        __pyx_v_RMSMQ = (__pyx_v_RMSMQ + (__pyx_v_pRead->mapq * __pyx_v_pRead->mapq));

        /* "vcfutils.pyx":1352
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 * 
 *                 if varInGenotype:             # <<<<<<<<<<<<<<
 *                     TC_ab += 1
 * 
 */
        __pyx_t_10 = (__pyx_v_varInGenotype != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1353
 * 
 *                 if varInGenotype:
 *                     TC_ab += 1             # <<<<<<<<<<<<<<
 * 
 *                     if Read_IsReverse(pRead):
 */
          __pyx_v_TC_ab = (__pyx_v_TC_ab + 1);

          /* "vcfutils.pyx":1355
 *                     TC_ab += 1
 * 
 *                     if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                         TCR_sb += 1
 *                     else:
 */
          __pyx_t_10 = (__pyx_f_13htslibWrapper_Read_IsReverse(__pyx_v_pRead) != 0);
          if (__pyx_t_10) {

            /* "vcfutils.pyx":1356
 * 
 *                     if Read_IsReverse(pRead):
 *                         TCR_sb += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         TCF_sb += 1
 */
            __pyx_v_TCR_sb = (__pyx_v_TCR_sb + 1);

            /* "vcfutils.pyx":1355
 *                     TC_ab += 1
 * 
 *                     if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                         TCR_sb += 1
 *                     else:
 */
            goto __pyx_L18;
          }

          /* "vcfutils.pyx":1358
 *                         TCR_sb += 1
 *                     else:
 *                         TCF_sb += 1             # <<<<<<<<<<<<<<
 * 
 *                 if Read_IsReverse(pRead):
 */
          /*else*/ {
            __pyx_v_TCF_sb = (__pyx_v_TCF_sb + 1);
          }
          __pyx_L18:;

          /* "vcfutils.pyx":1352
 *                 RMSMQ += (pRead.mapq*pRead.mapq)
 * 
 *                 if varInGenotype:             # <<<<<<<<<<<<<<
 *                     TC_ab += 1
 * 
 */
        }

        /* "vcfutils.pyx":1360
 *                         TCF_sb += 1
 * 
 *                 if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                     TCR += 1
 *                 else:
 */
        __pyx_t_10 = (__pyx_f_13htslibWrapper_Read_IsReverse(__pyx_v_pRead) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1361
 * 
 *                 if Read_IsReverse(pRead):
 *                     TCR += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     TCF += 1
 */
          __pyx_v_TCR = (__pyx_v_TCR + 1);

          /* "vcfutils.pyx":1360
 *                         TCF_sb += 1
 * 
 *                 if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                     TCR += 1
 *                 else:
 */
          goto __pyx_L19;
        }

        /* "vcfutils.pyx":1363
 *                     TCR += 1
 *                 else:
 *                     TCF += 1             # <<<<<<<<<<<<<<
 * 
 *                 # Check if read supports variant.
 */
        /*else*/ {
          __pyx_v_TCF = (__pyx_v_TCF + 1);
        }
        __pyx_L19:;

        /* "vcfutils.pyx":1366
 * 
 *                 # Check if read supports variant.
 *                 if variantSupportedByRead(pRead, varBAMMinPos, varBAMMaxPos, variant, countOnlyExactIndelMatches):             # <<<<<<<<<<<<<<
 * 
 *                     TR += 1
 */
        __pyx_t_10 = (__pyx_f_8vcfutils_variantSupportedByRead(__pyx_v_pRead, __pyx_v_varBAMMinPos, __pyx_v_varBAMMaxPos, __pyx_v_variant, __pyx_v_countOnlyExactIndelMatches) != 0);
        if (__pyx_t_10) {

          /* "vcfutils.pyx":1368
 *                 if variantSupportedByRead(pRead, varBAMMinPos, varBAMMaxPos, variant, countOnlyExactIndelMatches):
 * 
 *                     TR += 1             # <<<<<<<<<<<<<<
 *                     nVarReadsThisSample += 1
 * 
 */
          __pyx_v_TR = (__pyx_v_TR + 1);

          /* "vcfutils.pyx":1369
 * 
 *                     TR += 1
 *                     nVarReadsThisSample += 1             # <<<<<<<<<<<<<<
 * 
 *                     if varInGenotype:
 */
          __pyx_v_nVarReadsThisSample = (__pyx_v_nVarReadsThisSample + 1);

          /* "vcfutils.pyx":1371
 *                     nVarReadsThisSample += 1
 * 
 *                     if varInGenotype:             # <<<<<<<<<<<<<<
 *                         TR_ab += 1
 * 
 */
          __pyx_t_10 = (__pyx_v_varInGenotype != 0);
          if (__pyx_t_10) {

            /* "vcfutils.pyx":1372
 * 
 *                     if varInGenotype:
 *                         TR_ab += 1             # <<<<<<<<<<<<<<
 * 
 *                         if Read_IsReverse(pRead):
 */
            __pyx_v_TR_ab = (__pyx_v_TR_ab + 1);

            /* "vcfutils.pyx":1374
 *                         TR_ab += 1
 * 
 *                         if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                             NR_sb += 1
 *                         else:
 */
            __pyx_t_10 = (__pyx_f_13htslibWrapper_Read_IsReverse(__pyx_v_pRead) != 0);
            if (__pyx_t_10) {

              /* "vcfutils.pyx":1375
 * 
 *                         if Read_IsReverse(pRead):
 *                             NR_sb += 1             # <<<<<<<<<<<<<<
 *                         else:
 *                             NF_sb += 1
 */
              __pyx_v_NR_sb = (__pyx_v_NR_sb + 1);

              /* "vcfutils.pyx":1374
 *                         TR_ab += 1
 * 
 *                         if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                             NR_sb += 1
 *                         else:
 */
              goto __pyx_L22;
            }

            /* "vcfutils.pyx":1377
 *                             NR_sb += 1
 *                         else:
 *                             NF_sb += 1             # <<<<<<<<<<<<<<
 * 
 *                     if Read_IsReverse(pRead):
 */
            /*else*/ {
              __pyx_v_NF_sb = (__pyx_v_NF_sb + 1);
            }
            __pyx_L22:;

            /* "vcfutils.pyx":1371
 *                     nVarReadsThisSample += 1
 * 
 *                     if varInGenotype:             # <<<<<<<<<<<<<<
 *                         TR_ab += 1
 * 
 */
          }

          /* "vcfutils.pyx":1379
 *                             NF_sb += 1
 * 
 *                     if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                         NR += 1
 *                     else:
 */
          __pyx_t_10 = (__pyx_f_13htslibWrapper_Read_IsReverse(__pyx_v_pRead) != 0);
          if (__pyx_t_10) {

            /* "vcfutils.pyx":1380
 * 
 *                     if Read_IsReverse(pRead):
 *                         NR += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         NF += 1
 */
            __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_NR, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF_SET(__pyx_v_NR, __pyx_t_3);
            __pyx_t_3 = 0;

            /* "vcfutils.pyx":1379
 *                             NF_sb += 1
 * 
 *                     if Read_IsReverse(pRead):             # <<<<<<<<<<<<<<
 *                         NR += 1
 *                     else:
 */
            goto __pyx_L23;
          }

          /* "vcfutils.pyx":1382
 *                         NR += 1
 *                     else:
 *                         NF += 1             # <<<<<<<<<<<<<<
 * 
 *                     # Loop over window around variant position, and store smallest quality
 */
          /*else*/ {
            __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_NF, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF_SET(__pyx_v_NF, __pyx_t_3);
            __pyx_t_3 = 0;
          }
          __pyx_L23:;

          /* "vcfutils.pyx":1388
 * 
 *                     # Only compute MMLQ for samples which support the variant
 *                     if varInGenotype:             # <<<<<<<<<<<<<<
 *                         windowStart = max(0, varBAMMinPos - pRead.pos - (windowSize-1)//2)
 *                         windowEnd = min(pRead.rlen, varBAMMaxPos - pRead.pos + (windowSize-1)//2)
 */
          __pyx_t_10 = (__pyx_v_varInGenotype != 0);
          if (__pyx_t_10) {

            /* "vcfutils.pyx":1389
 *                     # Only compute MMLQ for samples which support the variant
 *                     if varInGenotype:
 *                         windowStart = max(0, varBAMMinPos - pRead.pos - (windowSize-1)//2)             # <<<<<<<<<<<<<<
 *                         windowEnd = min(pRead.rlen, varBAMMaxPos - pRead.pos + (windowSize-1)//2)
 *                         minBaseQualInWindow = 0
 */
            __pyx_t_14 = ((__pyx_v_varBAMMinPos - __pyx_v_pRead->pos) - ((__pyx_v_windowSize - 1) / 2));
            __pyx_t_15 = 0;
            if (((__pyx_t_14 > __pyx_t_15) != 0)) {
              __pyx_t_16 = __pyx_t_14;
            } else {
              __pyx_t_16 = __pyx_t_15;
            }
            __pyx_v_windowStart = __pyx_t_16;

            /* "vcfutils.pyx":1390
 *                     if varInGenotype:
 *                         windowStart = max(0, varBAMMinPos - pRead.pos - (windowSize-1)//2)
 *                         windowEnd = min(pRead.rlen, varBAMMaxPos - pRead.pos + (windowSize-1)//2)             # <<<<<<<<<<<<<<
 *                         minBaseQualInWindow = 0
 * 
 */
            __pyx_t_16 = ((__pyx_v_varBAMMaxPos - __pyx_v_pRead->pos) + ((__pyx_v_windowSize - 1) / 2));
            __pyx_t_17 = __pyx_v_pRead->rlen;
            if (((__pyx_t_16 < __pyx_t_17) != 0)) {
              __pyx_t_14 = __pyx_t_16;
            } else {
              __pyx_t_14 = __pyx_t_17;
            }
            __pyx_v_windowEnd = __pyx_t_14;

            /* "vcfutils.pyx":1391
 *                         windowStart = max(0, varBAMMinPos - pRead.pos - (windowSize-1)//2)
 *                         windowEnd = min(pRead.rlen, varBAMMaxPos - pRead.pos + (windowSize-1)//2)
 *                         minBaseQualInWindow = 0             # <<<<<<<<<<<<<<
 * 
 *                         for windowIndex in range(windowStart, windowEnd):
 */
            __pyx_v_minBaseQualInWindow = 0;

            /* "vcfutils.pyx":1393
 *                         minBaseQualInWindow = 0
 * 
 *                         for windowIndex in range(windowStart, windowEnd):             # <<<<<<<<<<<<<<
 *                             if windowIndex == windowStart:
 *                                 minBaseQualInWindow = pRead.qual[windowIndex]
 */
            __pyx_t_18 = __pyx_v_windowEnd;
            __pyx_t_19 = __pyx_t_18;
            for (__pyx_t_20 = __pyx_v_windowStart; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
              __pyx_v_windowIndex = __pyx_t_20;

              /* "vcfutils.pyx":1394
 * 
 *                         for windowIndex in range(windowStart, windowEnd):
 *                             if windowIndex == windowStart:             # <<<<<<<<<<<<<<
 *                                 minBaseQualInWindow = pRead.qual[windowIndex]
 *                             else:
 */
              __pyx_t_10 = ((__pyx_v_windowIndex == __pyx_v_windowStart) != 0);
              if (__pyx_t_10) {

                /* "vcfutils.pyx":1395
 *                         for windowIndex in range(windowStart, windowEnd):
 *                             if windowIndex == windowStart:
 *                                 minBaseQualInWindow = pRead.qual[windowIndex]             # <<<<<<<<<<<<<<
 *                             else:
 *                                 minBaseQualInWindow = min(minBaseQualInWindow, pRead.qual[windowIndex])
 */
                __pyx_v_minBaseQualInWindow = (__pyx_v_pRead->qual[__pyx_v_windowIndex]);

                /* "vcfutils.pyx":1394
 * 
 *                         for windowIndex in range(windowStart, windowEnd):
 *                             if windowIndex == windowStart:             # <<<<<<<<<<<<<<
 *                                 minBaseQualInWindow = pRead.qual[windowIndex]
 *                             else:
 */
                goto __pyx_L27;
              }

              /* "vcfutils.pyx":1397
 *                                 minBaseQualInWindow = pRead.qual[windowIndex]
 *                             else:
 *                                 minBaseQualInWindow = min(minBaseQualInWindow, pRead.qual[windowIndex])             # <<<<<<<<<<<<<<
 * 
 *                         listOfMinBaseQuals.append(minBaseQualInWindow)
 */
              /*else*/ {
                __pyx_t_21 = (__pyx_v_pRead->qual[__pyx_v_windowIndex]);
                __pyx_t_22 = __pyx_v_minBaseQualInWindow;
                if (((__pyx_t_21 < __pyx_t_22) != 0)) {
                  __pyx_t_23 = __pyx_t_21;
                } else {
                  __pyx_t_23 = __pyx_t_22;
                }
                __pyx_v_minBaseQualInWindow = __pyx_t_23;
              }
              __pyx_L27:;
            }

            /* "vcfutils.pyx":1399
 *                                 minBaseQualInWindow = min(minBaseQualInWindow, pRead.qual[windowIndex])
 * 
 *                         listOfMinBaseQuals.append(minBaseQualInWindow)             # <<<<<<<<<<<<<<
 * 
 *                     #logger.debug('minBaseQuals list %s' %(';'.join(map(str, listOfMinBaseQuals))))
 */
            __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_minBaseQualInWindow); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1399, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_listOfMinBaseQuals, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1399, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

            /* "vcfutils.pyx":1388
 * 
 *                     # Only compute MMLQ for samples which support the variant
 *                     if varInGenotype:             # <<<<<<<<<<<<<<
 *                         windowStart = max(0, varBAMMinPos - pRead.pos - (windowSize-1)//2)
 *                         windowEnd = min(pRead.rlen, varBAMMaxPos - pRead.pos + (windowSize-1)//2)
 */
          }

          /* "vcfutils.pyx":1366
 * 
 *                 # Check if read supports variant.
 *                 if variantSupportedByRead(pRead, varBAMMinPos, varBAMMaxPos, variant, countOnlyExactIndelMatches):             # <<<<<<<<<<<<<<
 * 
 *                     TR += 1
 */
        }

        /* "vcfutils.pyx":1403
 *                     #logger.debug('minBaseQuals list %s' %(';'.join(map(str, listOfMinBaseQuals))))
 * 
 *                 pStartRead += 1             # <<<<<<<<<<<<<<
 * 
 *             nReadsPerSample.append(nReadsThisSample)
 */
        __pyx_v_pStartRead = (__pyx_v_pStartRead + 1);
        __pyx_L13_continue:;
      }

      /* "vcfutils.pyx":1405
 *                 pStartRead += 1
 * 
 *             nReadsPerSample.append(nReadsThisSample)             # <<<<<<<<<<<<<<
 *             nVarReadsPerSample.append(nVarReadsThisSample)
 * 
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nReadsThisSample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1405, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_nReadsPerSample, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1405, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":1406
 * 
 *             nReadsPerSample.append(nReadsThisSample)
 *             nVarReadsPerSample.append(nVarReadsThisSample)             # <<<<<<<<<<<<<<
 * 
 *         # Compute per-sample strand-bias
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nVarReadsThisSample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_nVarReadsPerSample, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1406, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":1302
 *         varBAMMaxPos = variant.bamMaxPos
 * 
 *         for index,genotype in enumerate(genotypeCalls):             # <<<<<<<<<<<<<<
 * 
 *             varInGenotype = genotype is not None and variant in genotype
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1409
 * 
 *         # Compute per-sample strand-bias
 *         INFO[variant]['ABPV'] = [round(computeAlleleBiasPValue(TC_ab, TR_ab), 2)]             # <<<<<<<<<<<<<<
 *         INFO[variant]['SbPval'] = [round(computeStrandBiasPValue(TCF_sb, TCR_sb, NF_sb, NR_sb), 2)]
 *         INFO[variant]['TR'] = [TR]
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_f_8vcfutils_computeAlleleBiasPValue(__pyx_v_TC_ab, __pyx_v_TR_ab)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1409, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_ABPV, __pyx_t_3) < 0)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1410
 *         # Compute per-sample strand-bias
 *         INFO[variant]['ABPV'] = [round(computeAlleleBiasPValue(TC_ab, TR_ab), 2)]
 *         INFO[variant]['SbPval'] = [round(computeStrandBiasPValue(TCF_sb, TCR_sb, NF_sb, NR_sb), 2)]             # <<<<<<<<<<<<<<
 *         INFO[variant]['TR'] = [TR]
 *         INFO[variant]['NF'] = [NF]
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_f_8vcfutils_computeStrandBiasPValue(__pyx_v_TCF_sb, __pyx_v_TCR_sb, __pyx_v_NF_sb, __pyx_v_NR_sb)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1410, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_SbPval, __pyx_t_4) < 0)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1411
 *         INFO[variant]['ABPV'] = [round(computeAlleleBiasPValue(TC_ab, TR_ab), 2)]
 *         INFO[variant]['SbPval'] = [round(computeStrandBiasPValue(TCF_sb, TCR_sb, NF_sb, NR_sb), 2)]
 *         INFO[variant]['TR'] = [TR]             # <<<<<<<<<<<<<<
 *         INFO[variant]['NF'] = [NF]
 *         INFO[variant]['NR'] = [NR]
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_TR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1411, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_TR, __pyx_t_3) < 0)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1412
 *         INFO[variant]['SbPval'] = [round(computeStrandBiasPValue(TCF_sb, TCR_sb, NF_sb, NR_sb), 2)]
 *         INFO[variant]['TR'] = [TR]
 *         INFO[variant]['NF'] = [NF]             # <<<<<<<<<<<<<<
 *         INFO[variant]['NR'] = [NR]
 * 
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_NF);
    __Pyx_GIVEREF(__pyx_v_NF);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_NF);
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1412, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_NF, __pyx_t_3) < 0)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1413
 *         INFO[variant]['TR'] = [TR]
 *         INFO[variant]['NF'] = [NF]
 *         INFO[variant]['NR'] = [NR]             # <<<<<<<<<<<<<<
 * 
 *         if TR > 0:
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_NR);
    __Pyx_GIVEREF(__pyx_v_NR);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_NR);
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1413, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_NR, __pyx_t_3) < 0)) __PYX_ERR(0, 1413, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1415
 *         INFO[variant]['NR'] = [NR]
 * 
 *         if TR > 0:             # <<<<<<<<<<<<<<
 *             qual = float(INFO[variant]['PP'][0])
 *             if qual > 2500:
 */
    __pyx_t_10 = ((__pyx_v_TR > 0) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1416
 * 
 *         if TR > 0:
 *             qual = float(INFO[variant]['PP'][0])             # <<<<<<<<<<<<<<
 *             if qual > 2500:
 *                 INFO[variant]['QD'] = [options.qdThreshold + 10]
 */
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1416, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_PP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_24 = __Pyx_PyObject_AsDouble(__pyx_t_3); if (unlikely(__pyx_t_24 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_qual = __pyx_t_24;

      /* "vcfutils.pyx":1417
 *         if TR > 0:
 *             qual = float(INFO[variant]['PP'][0])
 *             if qual > 2500:             # <<<<<<<<<<<<<<
 *                 INFO[variant]['QD'] = [options.qdThreshold + 10]
 *             else:
 */
      __pyx_t_10 = ((__pyx_v_qual > 2500.0) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1418
 *             qual = float(INFO[variant]['PP'][0])
 *             if qual > 2500:
 *                 INFO[variant]['QD'] = [options.qdThreshold + 10]             # <<<<<<<<<<<<<<
 *             else:
 *                 INFO[variant]['QD'] = [(qual + (-10*log10(variant.calculatePrior(refFile))) )/TR]
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qdThreshold); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_10, 10, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
        __pyx_t_4 = 0;
        if (unlikely(__pyx_v_INFO == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1418, __pyx_L1_error)
        }
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_QD, __pyx_t_3) < 0)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "vcfutils.pyx":1417
 *         if TR > 0:
 *             qual = float(INFO[variant]['PP'][0])
 *             if qual > 2500:             # <<<<<<<<<<<<<<
 *                 INFO[variant]['QD'] = [options.qdThreshold + 10]
 *             else:
 */
        goto __pyx_L29;
      }

      /* "vcfutils.pyx":1420
 *                 INFO[variant]['QD'] = [options.qdThreshold + 10]
 *             else:
 *                 INFO[variant]['QD'] = [(qual + (-10*log10(variant.calculatePrior(refFile))) )/TR]             # <<<<<<<<<<<<<<
 *                 #logger.debug("Old QD = %s. new QD = %s. TR = %s. Qual = %s. Prior = %s. Var = %s" %(qual/TR, (qual + (-10*log10(variant.calculatePrior(refFile))))/TR, TR, qual, variant.calculatePrior(refFile), variant))
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_qual + (-10.0 * log10(((struct __pyx_vtabstruct_7variant_Variant *)__pyx_v_variant->__pyx_vtab)->calculatePrior(__pyx_v_variant, __pyx_v_refFile)))) / __pyx_v_TR)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        if (unlikely(__pyx_v_INFO == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1420, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_QD, __pyx_t_4) < 0)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L29:;

      /* "vcfutils.pyx":1415
 *         INFO[variant]['NR'] = [NR]
 * 
 *         if TR > 0:             # <<<<<<<<<<<<<<
 *             qual = float(INFO[variant]['PP'][0])
 *             if qual > 2500:
 */
      goto __pyx_L28;
    }

    /* "vcfutils.pyx":1424
 *         else:
 *             #logger.warning("Something is wrong. TR == 0 for variant %s" %(variant))
 *             INFO[variant]['QD'] = [0]             # <<<<<<<<<<<<<<
 * 
 *         INFO[variant]['BRF'] = [round(nBadReads/<double>(nGoodReads+nBadReads), 2)]
 */
    /*else*/ {
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1424, __pyx_L1_error)
      }
      __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_QD, __pyx_t_4) < 0)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L28:;

    /* "vcfutils.pyx":1426
 *             INFO[variant]['QD'] = [0]
 * 
 *         INFO[variant]['BRF'] = [round(nBadReads/<double>(nGoodReads+nBadReads), 2)]             # <<<<<<<<<<<<<<
 *         INFO[variant]['TC'] = [TC]
 *         INFO[variant]['TCR'] = [TCR]
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_nBadReads / ((double)(__pyx_v_nGoodReads + __pyx_v_nBadReads)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1426, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_BRF, __pyx_t_3) < 0)) __PYX_ERR(0, 1426, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1427
 * 
 *         INFO[variant]['BRF'] = [round(nBadReads/<double>(nGoodReads+nBadReads), 2)]
 *         INFO[variant]['TC'] = [TC]             # <<<<<<<<<<<<<<
 *         INFO[variant]['TCR'] = [TCR]
 *         INFO[variant]['TCF'] = [TCF]
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_TC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1427, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_TC, __pyx_t_4) < 0)) __PYX_ERR(0, 1427, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1428
 *         INFO[variant]['BRF'] = [round(nBadReads/<double>(nGoodReads+nBadReads), 2)]
 *         INFO[variant]['TC'] = [TC]
 *         INFO[variant]['TCR'] = [TCR]             # <<<<<<<<<<<<<<
 *         INFO[variant]['TCF'] = [TCF]
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_TCR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1428, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_TCR, __pyx_t_3) < 0)) __PYX_ERR(0, 1428, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1429
 *         INFO[variant]['TC'] = [TC]
 *         INFO[variant]['TCR'] = [TCR]
 *         INFO[variant]['TCF'] = [TCF]             # <<<<<<<<<<<<<<
 * 
 *         if TC + TC_bad > 0 and RMSMQ > 0:
 */
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_TCF); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1429, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_TCF, __pyx_t_4) < 0)) __PYX_ERR(0, 1429, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1431
 *         INFO[variant]['TCF'] = [TCF]
 * 
 *         if TC + TC_bad > 0 and RMSMQ > 0:             # <<<<<<<<<<<<<<
 *             INFO[variant]['MQ'] = [round(sqrt(RMSMQ/(TC+TC_bad)), 2)]
 *         else:
 */
    __pyx_t_11 = (((__pyx_v_TC + __pyx_v_TC_bad) > 0) != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_10 = __pyx_t_11;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_11 = ((__pyx_v_RMSMQ > 0.0) != 0);
    __pyx_t_10 = __pyx_t_11;
    __pyx_L31_bool_binop_done:;
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1432
 * 
 *         if TC + TC_bad > 0 and RMSMQ > 0:
 *             INFO[variant]['MQ'] = [round(sqrt(RMSMQ/(TC+TC_bad)), 2)]             # <<<<<<<<<<<<<<
 *         else:
 *             INFO[variant]['MQ'] = [0]
 */
      __pyx_t_4 = PyFloat_FromDouble(sqrt((__pyx_v_RMSMQ / (__pyx_v_TC + __pyx_v_TC_bad)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_round, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1432, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_MQ, __pyx_t_3) < 0)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "vcfutils.pyx":1431
 *         INFO[variant]['TCF'] = [TCF]
 * 
 *         if TC + TC_bad > 0 and RMSMQ > 0:             # <<<<<<<<<<<<<<
 *             INFO[variant]['MQ'] = [round(sqrt(RMSMQ/(TC+TC_bad)), 2)]
 *         else:
 */
      goto __pyx_L30;
    }

    /* "vcfutils.pyx":1434
 *             INFO[variant]['MQ'] = [round(sqrt(RMSMQ/(TC+TC_bad)), 2)]
 *         else:
 *             INFO[variant]['MQ'] = [0]             # <<<<<<<<<<<<<<
 * 
 *         INFO[variant]['nReadsPerSample'] = nReadsPerSample
 */
    /*else*/ {
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1434, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_MQ, __pyx_t_3) < 0)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L30:;

    /* "vcfutils.pyx":1436
 *             INFO[variant]['MQ'] = [0]
 * 
 *         INFO[variant]['nReadsPerSample'] = nReadsPerSample             # <<<<<<<<<<<<<<
 *         INFO[variant]['nVarReadsPerSample'] = nVarReadsPerSample
 *         INFO[variant]['FR'][0] = "%1.4f" %(INFO[variant]['FR'][0])
 */
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1436, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1436, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_nReadsPerSample, __pyx_v_nReadsPerSample) < 0)) __PYX_ERR(0, 1436, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1437
 * 
 *         INFO[variant]['nReadsPerSample'] = nReadsPerSample
 *         INFO[variant]['nVarReadsPerSample'] = nVarReadsPerSample             # <<<<<<<<<<<<<<
 *         INFO[variant]['FR'][0] = "%1.4f" %(INFO[variant]['FR'][0])
 *         INFO[variant]['HapScore'] = [HapScore]
 */
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1437, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_nVarReadsPerSample, __pyx_v_nVarReadsPerSample) < 0)) __PYX_ERR(0, 1437, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "vcfutils.pyx":1438
 *         INFO[variant]['nReadsPerSample'] = nReadsPerSample
 *         INFO[variant]['nVarReadsPerSample'] = nVarReadsPerSample
 *         INFO[variant]['FR'][0] = "%1.4f" %(INFO[variant]['FR'][0])             # <<<<<<<<<<<<<<
 *         INFO[variant]['HapScore'] = [HapScore]
 * 
 */
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1438, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_FR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_1_4f, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1438, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_25 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_FR); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__Pyx_SetItemInt(__pyx_t_25, 0, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 1438, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1439
 *         INFO[variant]['nVarReadsPerSample'] = nVarReadsPerSample
 *         INFO[variant]['FR'][0] = "%1.4f" %(INFO[variant]['FR'][0])
 *         INFO[variant]['HapScore'] = [HapScore]             # <<<<<<<<<<<<<<
 * 
 *         listOfMinBaseQuals.sort()
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_HapScore); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_25 = PyList_New(1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_25, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1439, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_n_s_HapScore, __pyx_t_25) < 0)) __PYX_ERR(0, 1439, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;

    /* "vcfutils.pyx":1441
 *         INFO[variant]['HapScore'] = [HapScore]
 * 
 *         listOfMinBaseQuals.sort()             # <<<<<<<<<<<<<<
 * 
 *         if len(listOfMinBaseQuals) > 0:
 */
    __pyx_t_5 = PyList_Sort(__pyx_v_listOfMinBaseQuals); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1441, __pyx_L1_error)

    /* "vcfutils.pyx":1443
 *         listOfMinBaseQuals.sort()
 * 
 *         if len(listOfMinBaseQuals) > 0:             # <<<<<<<<<<<<<<
 *             INFO[variant]['MMLQ'] = [listOfMinBaseQuals[ len(listOfMinBaseQuals) // 2 ]]
 *         else:
 */
    __pyx_t_9 = PyList_GET_SIZE(__pyx_v_listOfMinBaseQuals); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1443, __pyx_L1_error)
    __pyx_t_10 = ((__pyx_t_9 > 0) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1444
 * 
 *         if len(listOfMinBaseQuals) > 0:
 *             INFO[variant]['MMLQ'] = [listOfMinBaseQuals[ len(listOfMinBaseQuals) // 2 ]]             # <<<<<<<<<<<<<<
 *         else:
 *             INFO[variant]['MMLQ'] = [100]
 */
      __pyx_t_9 = PyList_GET_SIZE(__pyx_v_listOfMinBaseQuals); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1444, __pyx_L1_error)
      __pyx_t_26 = (__pyx_t_9 / 2);
      __pyx_t_25 = __Pyx_GetItemInt_List(__pyx_v_listOfMinBaseQuals, __pyx_t_26, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_25);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_25);
      __pyx_t_25 = 0;
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1444, __pyx_L1_error)
      }
      __pyx_t_25 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      if (unlikely(PyObject_SetItem(__pyx_t_25, __pyx_n_s_MMLQ, __pyx_t_4) < 0)) __PYX_ERR(0, 1444, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":1443
 *         listOfMinBaseQuals.sort()
 * 
 *         if len(listOfMinBaseQuals) > 0:             # <<<<<<<<<<<<<<
 *             INFO[variant]['MMLQ'] = [listOfMinBaseQuals[ len(listOfMinBaseQuals) // 2 ]]
 *         else:
 */
      goto __pyx_L33;
    }

    /* "vcfutils.pyx":1446
 *             INFO[variant]['MMLQ'] = [listOfMinBaseQuals[ len(listOfMinBaseQuals) // 2 ]]
 *         else:
 *             INFO[variant]['MMLQ'] = [100]             # <<<<<<<<<<<<<<
 * 
 *         INFO[variant]["Source"] = []
 */
    /*else*/ {
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_100);
      __Pyx_GIVEREF(__pyx_int_100);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_100);
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1446, __pyx_L1_error)
      }
      __pyx_t_25 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      if (unlikely(PyObject_SetItem(__pyx_t_25, __pyx_n_s_MMLQ, __pyx_t_4) < 0)) __PYX_ERR(0, 1446, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L33:;

    /* "vcfutils.pyx":1448
 *             INFO[variant]['MMLQ'] = [100]
 * 
 *         INFO[variant]["Source"] = []             # <<<<<<<<<<<<<<
 * 
 *         if variant.varSource & PLATYPUS_VAR:
 */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__pyx_v_INFO == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1448, __pyx_L1_error)
    }
    __pyx_t_25 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    if (unlikely(PyObject_SetItem(__pyx_t_25, __pyx_n_s_Source, __pyx_t_4) < 0)) __PYX_ERR(0, 1448, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "vcfutils.pyx":1450
 *         INFO[variant]["Source"] = []
 * 
 *         if variant.varSource & PLATYPUS_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("Platypus")
 * 
 */
    __pyx_t_10 = ((__pyx_v_variant->varSource & __pyx_v_7variant_PLATYPUS_VAR) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1451
 * 
 *         if variant.varSource & PLATYPUS_VAR:
 *             INFO[variant]["Source"].append("Platypus")             # <<<<<<<<<<<<<<
 * 
 *         if variant.varSource & ASSEMBLER_VAR:
 */
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1451, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_25 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_s_Source); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_25, __pyx_n_s_Platypus); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1451, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;

      /* "vcfutils.pyx":1450
 *         INFO[variant]["Source"] = []
 * 
 *         if variant.varSource & PLATYPUS_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("Platypus")
 * 
 */
    }

    /* "vcfutils.pyx":1453
 *             INFO[variant]["Source"].append("Platypus")
 * 
 *         if variant.varSource & ASSEMBLER_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("Assembler")
 * 
 */
    __pyx_t_10 = ((__pyx_v_variant->varSource & __pyx_v_7variant_ASSEMBLER_VAR) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1454
 * 
 *         if variant.varSource & ASSEMBLER_VAR:
 *             INFO[variant]["Source"].append("Assembler")             # <<<<<<<<<<<<<<
 * 
 *         if variant.varSource & FILE_VAR:
 */
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1454, __pyx_L1_error)
      }
      __pyx_t_25 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1454, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_25, __pyx_n_s_Source); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1454, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_n_s_Assembler); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1454, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "vcfutils.pyx":1453
 *             INFO[variant]["Source"].append("Platypus")
 * 
 *         if variant.varSource & ASSEMBLER_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("Assembler")
 * 
 */
    }

    /* "vcfutils.pyx":1456
 *             INFO[variant]["Source"].append("Assembler")
 * 
 *         if variant.varSource & FILE_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("File")
 * 
 */
    __pyx_t_10 = ((__pyx_v_variant->varSource & __pyx_v_7variant_FILE_VAR) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1457
 * 
 *         if variant.varSource & FILE_VAR:
 *             INFO[variant]["Source"].append("File")             # <<<<<<<<<<<<<<
 * 
 *     return INFO
 */
      if (unlikely(__pyx_v_INFO == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1457, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_INFO, ((PyObject *)__pyx_v_variant)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_25 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_s_Source); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_25, __pyx_n_s_File); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1457, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;

      /* "vcfutils.pyx":1456
 *             INFO[variant]["Source"].append("Assembler")
 * 
 *         if variant.varSource & FILE_VAR:             # <<<<<<<<<<<<<<
 *             INFO[variant]["Source"].append("File")
 * 
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1459
 *             INFO[variant]["Source"].append("File")
 * 
 *     return INFO             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_INFO);
  __pyx_r = __pyx_v_INFO;
  goto __pyx_L0;

  /* "vcfutils.pyx":1226
 * ###################################################################################################
 * 
 * cdef dict vcfINFO(double* haplotypeFrequencies, dict variantPosteriors, list genotypeCalls, list genotypes, list haplotypes, list readBuffers, int nHaplotypes, options, FastaFile refFile):             # <<<<<<<<<<<<<<
 *     """
 *     INFO field for vcf output, two level dictionary of variant - info field - value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_AddTraceback("vcfutils.vcfINFO", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_variant);
  __Pyx_XDECREF(__pyx_v_nReadsPerSample);
  __Pyx_XDECREF(__pyx_v_nVarReadsPerSample);
  __Pyx_XDECREF(__pyx_v_listOfMinBaseQuals);
  __Pyx_XDECREF((PyObject *)__pyx_v_readBuffer);
  __Pyx_XDECREF(__pyx_v_INFO);
  __Pyx_XDECREF(__pyx_v_sortedVars);
  __Pyx_XDECREF(__pyx_v_NR);
  __Pyx_XDECREF(__pyx_v_NF);
  __Pyx_XDECREF(__pyx_v_genotype);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1463
 * ###################################################################################################
 * 
 * cdef double andersonDarlingTest(list readPositions):             # <<<<<<<<<<<<<<
 *     """
 *     Compute the Anderson-Darling test statistic, to see if the positions
 */

static double __pyx_f_8vcfutils_andersonDarlingTest(PyObject *__pyx_v_readPositions) {
  PyObject *__pyx_v_nReads = NULL;
  PyObject *__pyx_v_Asquared = NULL;
  PyObject *__pyx_v_i = NULL;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("andersonDarlingTest", 0);

  /* "vcfutils.pyx":1469
 *     """
 *     # Sort in ascending order.
 *     readPositions.sort()             # <<<<<<<<<<<<<<
 *     nReads = len(readPositions)
 *     Asquared = -nReads
 */
  if (unlikely(__pyx_v_readPositions == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "sort");
    __PYX_ERR(0, 1469, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_Sort(__pyx_v_readPositions); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1469, __pyx_L1_error)

  /* "vcfutils.pyx":1470
 *     # Sort in ascending order.
 *     readPositions.sort()
 *     nReads = len(readPositions)             # <<<<<<<<<<<<<<
 *     Asquared = -nReads
 * 
 */
  if (unlikely(__pyx_v_readPositions == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1470, __pyx_L1_error)
  }
  __pyx_t_2 = PyList_GET_SIZE(__pyx_v_readPositions); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1470, __pyx_L1_error)
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_nReads = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "vcfutils.pyx":1471
 *     readPositions.sort()
 *     nReads = len(readPositions)
 *     Asquared = -nReads             # <<<<<<<<<<<<<<
 * 
 *     for i in xrange(nReads):
 */
  __pyx_t_3 = PyNumber_Negative(__pyx_v_nReads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_Asquared = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "vcfutils.pyx":1473
 *     Asquared = -nReads
 * 
 *     for i in xrange(nReads):             # <<<<<<<<<<<<<<
 *         Asquared -= (1.0/nReads)*( (2.0*i - 1.0)*log(readPositions[i]) + (2.0*nReads + 1.0  - 2.0*i)*log(1.0 - readPositions[i]) )
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_xrange, __pyx_v_nReads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1473, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1473, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1473, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1473, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "vcfutils.pyx":1474
 * 
 *     for i in xrange(nReads):
 *         Asquared -= (1.0/nReads)*( (2.0*i - 1.0)*log(readPositions[i]) + (2.0*nReads + 1.0  - 2.0*i)*log(1.0 - readPositions[i]) )             # <<<<<<<<<<<<<<
 * 
 *     return Asquared
 */
    __pyx_t_3 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_nReads, 1.0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyFloat_SubtractObjC(__pyx_t_6, __pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v_readPositions == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1474, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_readPositions, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(log(__pyx_t_8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_nReads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyFloat_AddObjC(__pyx_t_6, __pyx_float_1_0, 1.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_0, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = PyNumber_Subtract(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v_readPositions == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1474, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_readPositions, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_t_6, 1.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyFloat_FromDouble(log(__pyx_t_8)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_InPlaceSubtract(__pyx_v_Asquared, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_Asquared, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "vcfutils.pyx":1473
 *     Asquared = -nReads
 * 
 *     for i in xrange(nReads):             # <<<<<<<<<<<<<<
 *         Asquared -= (1.0/nReads)*( (2.0*i - 1.0)*log(readPositions[i]) + (2.0*nReads + 1.0  - 2.0*i)*log(1.0 - readPositions[i]) )
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "vcfutils.pyx":1476
 *         Asquared -= (1.0/nReads)*( (2.0*i - 1.0)*log(readPositions[i]) + (2.0*nReads + 1.0  - 2.0*i)*log(1.0 - readPositions[i]) )
 * 
 *     return Asquared             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_Asquared); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1476, __pyx_L1_error)
  __pyx_r = __pyx_t_8;
  goto __pyx_L0;

  /* "vcfutils.pyx":1463
 * ###################################################################################################
 * 
 * cdef double andersonDarlingTest(list readPositions):             # <<<<<<<<<<<<<<
 *     """
 *     Compute the Anderson-Darling test statistic, to see if the positions
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("vcfutils.andersonDarlingTest", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nReads);
  __Pyx_XDECREF(__pyx_v_Asquared);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1480
 * ###################################################################################################
 * 
 * cdef double computeSCValue(sequence):             # <<<<<<<<<<<<<<
 *     """
 *     Compute the value for Platypus' SC filter. This is simply the
 */

static double __pyx_f_8vcfutils_computeSCValue(PyObject *__pyx_v_sequence) {
  PyObject *__pyx_v_counter = NULL;
  PyObject *__pyx_v_char = NULL;
  int __pyx_v_lenSeq;
  int __pyx_v_nCharsFromTop2Bases;
  double __pyx_v_SC;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_base = NULL;
  PyObject *__pyx_v_nChars = NULL;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("computeSCValue", 0);

  /* "vcfutils.pyx":1487
 *     value of 1.0, as would a homopolymer.
 *     """
 *     counter = {}             # <<<<<<<<<<<<<<
 * 
 *     for char in sequence:
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_counter = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1489
 *     counter = {}
 * 
 *     for char in sequence:             # <<<<<<<<<<<<<<
 *         if char not in counter:
 *             counter[char] = 1
 */
  if (likely(PyList_CheckExact(__pyx_v_sequence)) || PyTuple_CheckExact(__pyx_v_sequence)) {
    __pyx_t_1 = __pyx_v_sequence; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1489, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1489, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1489, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1489, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1489, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1489, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1489, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_char, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "vcfutils.pyx":1490
 * 
 *     for char in sequence:
 *         if char not in counter:             # <<<<<<<<<<<<<<
 *             counter[char] = 1
 *         else:
 */
    __pyx_t_5 = (__Pyx_PyDict_ContainsTF(__pyx_v_char, __pyx_v_counter, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1490, __pyx_L1_error)
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {

      /* "vcfutils.pyx":1491
 *     for char in sequence:
 *         if char not in counter:
 *             counter[char] = 1             # <<<<<<<<<<<<<<
 *         else:
 *             counter[char] += 1
 */
      if (unlikely(PyDict_SetItem(__pyx_v_counter, __pyx_v_char, __pyx_int_1) < 0)) __PYX_ERR(0, 1491, __pyx_L1_error)

      /* "vcfutils.pyx":1490
 * 
 *     for char in sequence:
 *         if char not in counter:             # <<<<<<<<<<<<<<
 *             counter[char] = 1
 *         else:
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1493
 *             counter[char] = 1
 *         else:
 *             counter[char] += 1             # <<<<<<<<<<<<<<
 * 
 *     cdef int lenSeq = len(sequence)
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_char);
      __pyx_t_4 = __pyx_v_char;
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_counter, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_counter, __pyx_t_4, __pyx_t_8) < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L5:;

    /* "vcfutils.pyx":1489
 *     counter = {}
 * 
 *     for char in sequence:             # <<<<<<<<<<<<<<
 *         if char not in counter:
 *             counter[char] = 1
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1495
 *             counter[char] += 1
 * 
 *     cdef int lenSeq = len(sequence)             # <<<<<<<<<<<<<<
 *     cdef int nCharsFromTop2Bases = sum([x[0] for x in sorted( [(nChars,base) for base,nChars in counter.iteritems()], reverse=True)[0:2] ])
 *     cdef double SC = <double>(nCharsFromTop2Bases)/<double>(lenSeq)
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_sequence); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1495, __pyx_L1_error)
  __pyx_v_lenSeq = __pyx_t_2;

  /* "vcfutils.pyx":1496
 * 
 *     cdef int lenSeq = len(sequence)
 *     cdef int nCharsFromTop2Bases = sum([x[0] for x in sorted( [(nChars,base) for base,nChars in counter.iteritems()], reverse=True)[0:2] ])             # <<<<<<<<<<<<<<
 *     cdef double SC = <double>(nCharsFromTop2Bases)/<double>(lenSeq)
 *     return SC
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_counter, 1, __pyx_n_s_iteritems, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __pyx_t_8 = __pyx_t_7;
  __pyx_t_7 = 0;
  while (1) {
    __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_8, __pyx_t_9, &__pyx_t_2, &__pyx_t_7, &__pyx_t_11, NULL, __pyx_t_10);
    if (unlikely(__pyx_t_12 == 0)) break;
    if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_XDECREF_SET(__pyx_v_base, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_nChars, __pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_v_nChars);
    __Pyx_GIVEREF(__pyx_v_nChars);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nChars);
    __Pyx_INCREF(__pyx_v_base);
    __Pyx_GIVEREF(__pyx_v_base);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_base);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_reverse, Py_True) < 0) __PYX_ERR(0, 1496, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_sorted, __pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_t_11, 0, 2, NULL, NULL, &__pyx_slice__9, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_11 = __pyx_t_4; __Pyx_INCREF(__pyx_t_11); __pyx_t_9 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1496, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_11))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_11)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1496, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1496, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_11);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1496, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_nCharsFromTop2Bases = __pyx_t_10;

  /* "vcfutils.pyx":1497
 *     cdef int lenSeq = len(sequence)
 *     cdef int nCharsFromTop2Bases = sum([x[0] for x in sorted( [(nChars,base) for base,nChars in counter.iteritems()], reverse=True)[0:2] ])
 *     cdef double SC = <double>(nCharsFromTop2Bases)/<double>(lenSeq)             # <<<<<<<<<<<<<<
 *     return SC
 * 
 */
  __pyx_v_SC = (((double)__pyx_v_nCharsFromTop2Bases) / ((double)__pyx_v_lenSeq));

  /* "vcfutils.pyx":1498
 *     cdef int nCharsFromTop2Bases = sum([x[0] for x in sorted( [(nChars,base) for base,nChars in counter.iteritems()], reverse=True)[0:2] ])
 *     cdef double SC = <double>(nCharsFromTop2Bases)/<double>(lenSeq)
 *     return SC             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_r = __pyx_v_SC;
  goto __pyx_L0;

  /* "vcfutils.pyx":1480
 * ###################################################################################################
 * 
 * cdef double computeSCValue(sequence):             # <<<<<<<<<<<<<<
 *     """
 *     Compute the value for Platypus' SC filter. This is simply the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_WriteUnraisable("vcfutils.computeSCValue", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_counter);
  __Pyx_XDECREF(__pyx_v_char);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_base);
  __Pyx_XDECREF(__pyx_v_nChars);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "vcfutils.pyx":1502
 * ###################################################################################################
 * 
 * cdef dict vcfFILTER(list genotypeCalls, list haplotypes, dict vcfInfo, dict varsByPos, options):             # <<<<<<<<<<<<<<
 *     """
 *     FILTER field for vcf output, two level dictionary of variant - info field - value
 */

static PyObject *__pyx_f_8vcfutils_vcfFILTER(CYTHON_UNUSED PyObject *__pyx_v_genotypeCalls, CYTHON_UNUSED PyObject *__pyx_v_haplotypes, PyObject *__pyx_v_vcfInfo, PyObject *__pyx_v_varsByPos, PyObject *__pyx_v_options) {
  struct __pyx_obj_7variant_Variant *__pyx_v_v = 0;
  PyObject *__pyx_v_FILTER = 0;
  PyObject *__pyx_v_infoThisVar = 0;
  int __pyx_v_nVars;
  int __pyx_v_nVarsQD;
  int __pyx_v_nVarsHapScore;
  int __pyx_v_nVarsSB;
  int __pyx_v_nVarsAB;
  int __pyx_v_nVarsRMSMQ;
  CYTHON_UNUSED int __pyx_v_totalVarReads;
  int __pyx_v_hapScore;
  int __pyx_v_totalReads;
  CYTHON_UNUSED int __pyx_v_totalFwdReads;
  CYTHON_UNUSED int __pyx_v_totalRevReads;
  int __pyx_v_nVarsFailingMMLQFilter;
  int __pyx_v_medMinQualBases;
  double __pyx_v_abPVal;
  double __pyx_v_sbPVal;
  double __pyx_v_BRF;
  double __pyx_v_RMSMQ;
  double __pyx_v_QD;
  int __pyx_v_bestQual;
  int __pyx_v_thisQual;
  int __pyx_v_badReadsThreshold;
  double __pyx_v_abThreshold;
  double __pyx_v_sbThreshold;
  double __pyx_v_rmsmqThreshold;
  double __pyx_v_filteredReadsFrac;
  double __pyx_v_qdThreshold;
  double __pyx_v_hapScoreThreshold;
  double __pyx_v_scThreshold;
  int __pyx_v_failsSCFilter;
  CYTHON_UNUSED PyObject *__pyx_v_pos = NULL;
  PyObject *__pyx_v_varsAtPos = NULL;
  PyObject *__pyx_v_sequence = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_totalForwardVarReads = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_totalReverseVarReads = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  double __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  __Pyx_RefNannySetupContext("vcfFILTER", 0);

  /* "vcfutils.pyx":1507
 *     """
 *     cdef Variant v
 *     cdef dict FILTER = {}             # <<<<<<<<<<<<<<
 *     cdef dict hapFILTER
 *     cdef dict infoThisVar
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_FILTER = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "vcfutils.pyx":1510
 *     cdef dict hapFILTER
 *     cdef dict infoThisVar
 *     cdef int nVars = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsQD = 0
 *     cdef int nVarsHapScore = 0
 */
  __pyx_v_nVars = 0;

  /* "vcfutils.pyx":1511
 *     cdef dict infoThisVar
 *     cdef int nVars = 0
 *     cdef int nVarsQD = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsHapScore = 0
 *     cdef int nVarsSB = 0
 */
  __pyx_v_nVarsQD = 0;

  /* "vcfutils.pyx":1512
 *     cdef int nVars = 0
 *     cdef int nVarsQD = 0
 *     cdef int nVarsHapScore = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsSB = 0
 *     cdef int nVarsAB = 0
 */
  __pyx_v_nVarsHapScore = 0;

  /* "vcfutils.pyx":1513
 *     cdef int nVarsQD = 0
 *     cdef int nVarsHapScore = 0
 *     cdef int nVarsSB = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsAB = 0
 *     cdef int nVarsRMSMQ = 0
 */
  __pyx_v_nVarsSB = 0;

  /* "vcfutils.pyx":1514
 *     cdef int nVarsHapScore = 0
 *     cdef int nVarsSB = 0
 *     cdef int nVarsAB = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsRMSMQ = 0
 *     cdef int totalVarReads = 0
 */
  __pyx_v_nVarsAB = 0;

  /* "vcfutils.pyx":1515
 *     cdef int nVarsSB = 0
 *     cdef int nVarsAB = 0
 *     cdef int nVarsRMSMQ = 0             # <<<<<<<<<<<<<<
 *     cdef int totalVarReads = 0
 *     cdef int hapScore = 0
 */
  __pyx_v_nVarsRMSMQ = 0;

  /* "vcfutils.pyx":1516
 *     cdef int nVarsAB = 0
 *     cdef int nVarsRMSMQ = 0
 *     cdef int totalVarReads = 0             # <<<<<<<<<<<<<<
 *     cdef int hapScore = 0
 *     cdef int totalReads = 0
 */
  __pyx_v_totalVarReads = 0;

  /* "vcfutils.pyx":1517
 *     cdef int nVarsRMSMQ = 0
 *     cdef int totalVarReads = 0
 *     cdef int hapScore = 0             # <<<<<<<<<<<<<<
 *     cdef int totalReads = 0
 *     cdef int totalFwdReads = 0
 */
  __pyx_v_hapScore = 0;

  /* "vcfutils.pyx":1518
 *     cdef int totalVarReads = 0
 *     cdef int hapScore = 0
 *     cdef int totalReads = 0             # <<<<<<<<<<<<<<
 *     cdef int totalFwdReads = 0
 *     cdef int totalRevReads = 0
 */
  __pyx_v_totalReads = 0;

  /* "vcfutils.pyx":1519
 *     cdef int hapScore = 0
 *     cdef int totalReads = 0
 *     cdef int totalFwdReads = 0             # <<<<<<<<<<<<<<
 *     cdef int totalRevReads = 0
 *     cdef int nVarsFailingMMLQFilter = 0
 */
  __pyx_v_totalFwdReads = 0;

  /* "vcfutils.pyx":1520
 *     cdef int totalReads = 0
 *     cdef int totalFwdReads = 0
 *     cdef int totalRevReads = 0             # <<<<<<<<<<<<<<
 *     cdef int nVarsFailingMMLQFilter = 0
 *     cdef int medMinQualBases = 0
 */
  __pyx_v_totalRevReads = 0;

  /* "vcfutils.pyx":1521
 *     cdef int totalFwdReads = 0
 *     cdef int totalRevReads = 0
 *     cdef int nVarsFailingMMLQFilter = 0             # <<<<<<<<<<<<<<
 *     cdef int medMinQualBases = 0
 *     cdef double abPVal = 0.0
 */
  __pyx_v_nVarsFailingMMLQFilter = 0;

  /* "vcfutils.pyx":1522
 *     cdef int totalRevReads = 0
 *     cdef int nVarsFailingMMLQFilter = 0
 *     cdef int medMinQualBases = 0             # <<<<<<<<<<<<<<
 *     cdef double abPVal = 0.0
 *     cdef double sbPVal = 0.0
 */
  __pyx_v_medMinQualBases = 0;

  /* "vcfutils.pyx":1523
 *     cdef int nVarsFailingMMLQFilter = 0
 *     cdef int medMinQualBases = 0
 *     cdef double abPVal = 0.0             # <<<<<<<<<<<<<<
 *     cdef double sbPVal = 0.0
 *     cdef double BRF = 0.0
 */
  __pyx_v_abPVal = 0.0;

  /* "vcfutils.pyx":1524
 *     cdef int medMinQualBases = 0
 *     cdef double abPVal = 0.0
 *     cdef double sbPVal = 0.0             # <<<<<<<<<<<<<<
 *     cdef double BRF = 0.0
 *     cdef double RMSMQ = 0.0
 */
  __pyx_v_sbPVal = 0.0;

  /* "vcfutils.pyx":1525
 *     cdef double abPVal = 0.0
 *     cdef double sbPVal = 0.0
 *     cdef double BRF = 0.0             # <<<<<<<<<<<<<<
 *     cdef double RMSMQ = 0.0
 *     cdef double QD = 0.0
 */
  __pyx_v_BRF = 0.0;

  /* "vcfutils.pyx":1526
 *     cdef double sbPVal = 0.0
 *     cdef double BRF = 0.0
 *     cdef double RMSMQ = 0.0             # <<<<<<<<<<<<<<
 *     cdef double QD = 0.0
 *     cdef int bestQual = 0
 */
  __pyx_v_RMSMQ = 0.0;

  /* "vcfutils.pyx":1527
 *     cdef double BRF = 0.0
 *     cdef double RMSMQ = 0.0
 *     cdef double QD = 0.0             # <<<<<<<<<<<<<<
 *     cdef int bestQual = 0
 *     cdef int thisQual = 0
 */
  __pyx_v_QD = 0.0;

  /* "vcfutils.pyx":1528
 *     cdef double RMSMQ = 0.0
 *     cdef double QD = 0.0
 *     cdef int bestQual = 0             # <<<<<<<<<<<<<<
 *     cdef int thisQual = 0
 *     cdef int badReadsThreshold = options.badReadsThreshold
 */
  __pyx_v_bestQual = 0;

  /* "vcfutils.pyx":1529
 *     cdef double QD = 0.0
 *     cdef int bestQual = 0
 *     cdef int thisQual = 0             # <<<<<<<<<<<<<<
 *     cdef int badReadsThreshold = options.badReadsThreshold
 *     cdef double abThreshold = options.abThreshold
 */
  __pyx_v_thisQual = 0;

  /* "vcfutils.pyx":1530
 *     cdef int bestQual = 0
 *     cdef int thisQual = 0
 *     cdef int badReadsThreshold = options.badReadsThreshold             # <<<<<<<<<<<<<<
 *     cdef double abThreshold = options.abThreshold
 *     cdef double sbThreshold = options.sbThreshold
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_badReadsThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_badReadsThreshold = __pyx_t_2;

  /* "vcfutils.pyx":1531
 *     cdef int thisQual = 0
 *     cdef int badReadsThreshold = options.badReadsThreshold
 *     cdef double abThreshold = options.abThreshold             # <<<<<<<<<<<<<<
 *     cdef double sbThreshold = options.sbThreshold
 *     cdef double rmsmqThreshold = options.rmsmqThreshold
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_abThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_abThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1532
 *     cdef int badReadsThreshold = options.badReadsThreshold
 *     cdef double abThreshold = options.abThreshold
 *     cdef double sbThreshold = options.sbThreshold             # <<<<<<<<<<<<<<
 *     cdef double rmsmqThreshold = options.rmsmqThreshold
 *     cdef double filteredReadsFrac = options.filteredReadsFrac
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_sbThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sbThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1533
 *     cdef double abThreshold = options.abThreshold
 *     cdef double sbThreshold = options.sbThreshold
 *     cdef double rmsmqThreshold = options.rmsmqThreshold             # <<<<<<<<<<<<<<
 *     cdef double filteredReadsFrac = options.filteredReadsFrac
 *     cdef double qdThreshold = options.qdThreshold
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_rmsmqThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1533, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rmsmqThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1534
 *     cdef double sbThreshold = options.sbThreshold
 *     cdef double rmsmqThreshold = options.rmsmqThreshold
 *     cdef double filteredReadsFrac = options.filteredReadsFrac             # <<<<<<<<<<<<<<
 *     cdef double qdThreshold = options.qdThreshold
 *     cdef double hapScoreThreshold = options.hapScoreThreshold
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_filteredReadsFrac); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_filteredReadsFrac = __pyx_t_3;

  /* "vcfutils.pyx":1535
 *     cdef double rmsmqThreshold = options.rmsmqThreshold
 *     cdef double filteredReadsFrac = options.filteredReadsFrac
 *     cdef double qdThreshold = options.qdThreshold             # <<<<<<<<<<<<<<
 *     cdef double hapScoreThreshold = options.hapScoreThreshold
 *     cdef double scThreshold = options.scThreshold
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_qdThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_qdThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1536
 *     cdef double filteredReadsFrac = options.filteredReadsFrac
 *     cdef double qdThreshold = options.qdThreshold
 *     cdef double hapScoreThreshold = options.hapScoreThreshold             # <<<<<<<<<<<<<<
 *     cdef double scThreshold = options.scThreshold
 *     cdef int failsSCFilter = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_hapScoreThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_hapScoreThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1537
 *     cdef double qdThreshold = options.qdThreshold
 *     cdef double hapScoreThreshold = options.hapScoreThreshold
 *     cdef double scThreshold = options.scThreshold             # <<<<<<<<<<<<<<
 *     cdef int failsSCFilter = 0
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_scThreshold); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_scThreshold = __pyx_t_3;

  /* "vcfutils.pyx":1538
 *     cdef double hapScoreThreshold = options.hapScoreThreshold
 *     cdef double scThreshold = options.scThreshold
 *     cdef int failsSCFilter = 0             # <<<<<<<<<<<<<<
 * 
 *     for pos,varsAtPos in varsByPos.iteritems():
 */
  __pyx_v_failsSCFilter = 0;

  /* "vcfutils.pyx":1540
 *     cdef int failsSCFilter = 0
 * 
 *     for pos,varsAtPos in varsByPos.iteritems():             # <<<<<<<<<<<<<<
 * 
 *         nVars = len(varsAtPos)
 */
  __pyx_t_4 = 0;
  if (unlikely(__pyx_v_varsByPos == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(0, 1540, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_varsByPos, 1, __pyx_n_s_iteritems, (&__pyx_t_5), (&__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_5, &__pyx_t_4, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_2);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 1540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_pos, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_varsAtPos, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "vcfutils.pyx":1542
 *     for pos,varsAtPos in varsByPos.iteritems():
 * 
 *         nVars = len(varsAtPos)             # <<<<<<<<<<<<<<
 *         nVarsSB = 0
 *         nVarsAB = 0
 */
    __pyx_t_9 = PyObject_Length(__pyx_v_varsAtPos); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1542, __pyx_L1_error)
    __pyx_v_nVars = __pyx_t_9;

    /* "vcfutils.pyx":1543
 * 
 *         nVars = len(varsAtPos)
 *         nVarsSB = 0             # <<<<<<<<<<<<<<
 *         nVarsAB = 0
 *         nVarsQD = 0
 */
    __pyx_v_nVarsSB = 0;

    /* "vcfutils.pyx":1544
 *         nVars = len(varsAtPos)
 *         nVarsSB = 0
 *         nVarsAB = 0             # <<<<<<<<<<<<<<
 *         nVarsQD = 0
 *         nVarsHapScore = 0
 */
    __pyx_v_nVarsAB = 0;

    /* "vcfutils.pyx":1545
 *         nVarsSB = 0
 *         nVarsAB = 0
 *         nVarsQD = 0             # <<<<<<<<<<<<<<
 *         nVarsHapScore = 0
 *         nVarsRMSMQ = 0
 */
    __pyx_v_nVarsQD = 0;

    /* "vcfutils.pyx":1546
 *         nVarsAB = 0
 *         nVarsQD = 0
 *         nVarsHapScore = 0             # <<<<<<<<<<<<<<
 *         nVarsRMSMQ = 0
 *         nVarsFailingMMLQFilter = 0
 */
    __pyx_v_nVarsHapScore = 0;

    /* "vcfutils.pyx":1547
 *         nVarsQD = 0
 *         nVarsHapScore = 0
 *         nVarsRMSMQ = 0             # <<<<<<<<<<<<<<
 *         nVarsFailingMMLQFilter = 0
 *         hapScore = 0
 */
    __pyx_v_nVarsRMSMQ = 0;

    /* "vcfutils.pyx":1548
 *         nVarsHapScore = 0
 *         nVarsRMSMQ = 0
 *         nVarsFailingMMLQFilter = 0             # <<<<<<<<<<<<<<
 *         hapScore = 0
 *         QD = 0.0
 */
    __pyx_v_nVarsFailingMMLQFilter = 0;

    /* "vcfutils.pyx":1549
 *         nVarsRMSMQ = 0
 *         nVarsFailingMMLQFilter = 0
 *         hapScore = 0             # <<<<<<<<<<<<<<
 *         QD = 0.0
 *         bestQual = 0
 */
    __pyx_v_hapScore = 0;

    /* "vcfutils.pyx":1550
 *         nVarsFailingMMLQFilter = 0
 *         hapScore = 0
 *         QD = 0.0             # <<<<<<<<<<<<<<
 *         bestQual = 0
 * 
 */
    __pyx_v_QD = 0.0;

    /* "vcfutils.pyx":1551
 *         hapScore = 0
 *         QD = 0.0
 *         bestQual = 0             # <<<<<<<<<<<<<<
 * 
 *         sequence = vcfInfo[varsAtPos[0]]['SC'][0]
 */
    __pyx_v_bestQual = 0;

    /* "vcfutils.pyx":1553
 *         bestQual = 0
 * 
 *         sequence = vcfInfo[varsAtPos[0]]['SC'][0]             # <<<<<<<<<<<<<<
 * 
 *         if computeSCValue(sequence) > scThreshold:
 */
    if (unlikely(__pyx_v_vcfInfo == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1553, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_varsAtPos, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_vcfInfo, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_s_SC); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_sequence, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "vcfutils.pyx":1555
 *         sequence = vcfInfo[varsAtPos[0]]['SC'][0]
 * 
 *         if computeSCValue(sequence) > scThreshold:             # <<<<<<<<<<<<<<
 *             failsSCFilter = 1
 *         else:
 */
    __pyx_t_10 = ((__pyx_f_8vcfutils_computeSCValue(__pyx_v_sequence) > __pyx_v_scThreshold) != 0);
    if (__pyx_t_10) {

      /* "vcfutils.pyx":1556
 * 
 *         if computeSCValue(sequence) > scThreshold:
 *             failsSCFilter = 1             # <<<<<<<<<<<<<<
 *         else:
 *             failsSCFilter = 0
 */
      __pyx_v_failsSCFilter = 1;

      /* "vcfutils.pyx":1555
 *         sequence = vcfInfo[varsAtPos[0]]['SC'][0]
 * 
 *         if computeSCValue(sequence) > scThreshold:             # <<<<<<<<<<<<<<
 *             failsSCFilter = 1
 *         else:
 */
      goto __pyx_L5;
    }

    /* "vcfutils.pyx":1558
 *             failsSCFilter = 1
 *         else:
 *             failsSCFilter = 0             # <<<<<<<<<<<<<<
 * 
 *         for v in varsAtPos:
 */
    /*else*/ {
      __pyx_v_failsSCFilter = 0;
    }
    __pyx_L5:;

    /* "vcfutils.pyx":1560
 *             failsSCFilter = 0
 * 
 *         for v in varsAtPos:             # <<<<<<<<<<<<<<
 * 
 *             FILTER[v] = []
 */
    if (likely(PyList_CheckExact(__pyx_v_varsAtPos)) || PyTuple_CheckExact(__pyx_v_varsAtPos)) {
      __pyx_t_6 = __pyx_v_varsAtPos; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_varsAtPos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1560, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1560, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1560, __pyx_L1_error)
          #else
          __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1560, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          #endif
        }
      } else {
        __pyx_t_7 = __pyx_t_11(__pyx_t_6);
        if (unlikely(!__pyx_t_7)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1560, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_7);
      }
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "vcfutils.pyx":1562
 *         for v in varsAtPos:
 * 
 *             FILTER[v] = []             # <<<<<<<<<<<<<<
 *             infoThisVar = vcfInfo[v]
 *             hapScore = int(infoThisVar['HapScore'][0])
 */
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(PyDict_SetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v), __pyx_t_7) < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "vcfutils.pyx":1563
 * 
 *             FILTER[v] = []
 *             infoThisVar = vcfInfo[v]             # <<<<<<<<<<<<<<
 *             hapScore = int(infoThisVar['HapScore'][0])
 *             QD = float(infoThisVar['QD'][0])
 */
      if (unlikely(__pyx_v_vcfInfo == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1563, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_vcfInfo, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (!(likely(PyDict_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 1563, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_infoThisVar, ((PyObject*)__pyx_t_7));
      __pyx_t_7 = 0;

      /* "vcfutils.pyx":1564
 *             FILTER[v] = []
 *             infoThisVar = vcfInfo[v]
 *             hapScore = int(infoThisVar['HapScore'][0])             # <<<<<<<<<<<<<<
 *             QD = float(infoThisVar['QD'][0])
 *             BRF = float(infoThisVar['BRF'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1564, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_HapScore); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_hapScore = __pyx_t_8;

      /* "vcfutils.pyx":1565
 *             infoThisVar = vcfInfo[v]
 *             hapScore = int(infoThisVar['HapScore'][0])
 *             QD = float(infoThisVar['QD'][0])             # <<<<<<<<<<<<<<
 *             BRF = float(infoThisVar['BRF'][0])
 *             RMSMQ = float(infoThisVar['MQ'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1565, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_QD); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_t_12); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_QD = __pyx_t_3;

      /* "vcfutils.pyx":1566
 *             hapScore = int(infoThisVar['HapScore'][0])
 *             QD = float(infoThisVar['QD'][0])
 *             BRF = float(infoThisVar['BRF'][0])             # <<<<<<<<<<<<<<
 *             RMSMQ = float(infoThisVar['MQ'][0])
 *             totalForwardVarReads = int(infoThisVar['NF'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1566, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_BRF); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1566, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1566, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1566, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_BRF = __pyx_t_3;

      /* "vcfutils.pyx":1567
 *             QD = float(infoThisVar['QD'][0])
 *             BRF = float(infoThisVar['BRF'][0])
 *             RMSMQ = float(infoThisVar['MQ'][0])             # <<<<<<<<<<<<<<
 *             totalForwardVarReads = int(infoThisVar['NF'][0])
 *             totalReverseVarReads = int(infoThisVar['NR'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1567, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_MQ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_t_12); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_RMSMQ = __pyx_t_3;

      /* "vcfutils.pyx":1568
 *             BRF = float(infoThisVar['BRF'][0])
 *             RMSMQ = float(infoThisVar['MQ'][0])
 *             totalForwardVarReads = int(infoThisVar['NF'][0])             # <<<<<<<<<<<<<<
 *             totalReverseVarReads = int(infoThisVar['NR'][0])
 *             totalVarReads = int(infoThisVar['TR'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1568, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_NF); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_totalForwardVarReads, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "vcfutils.pyx":1569
 *             RMSMQ = float(infoThisVar['MQ'][0])
 *             totalForwardVarReads = int(infoThisVar['NF'][0])
 *             totalReverseVarReads = int(infoThisVar['NR'][0])             # <<<<<<<<<<<<<<
 *             totalVarReads = int(infoThisVar['TR'][0])
 *             totalReads = int(infoThisVar['TC'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1569, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_NR); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_totalReverseVarReads, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "vcfutils.pyx":1570
 *             totalForwardVarReads = int(infoThisVar['NF'][0])
 *             totalReverseVarReads = int(infoThisVar['NR'][0])
 *             totalVarReads = int(infoThisVar['TR'][0])             # <<<<<<<<<<<<<<
 *             totalReads = int(infoThisVar['TC'][0])
 *             totalFwdReads = int(infoThisVar['TCF'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1570, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_TR); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1570, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_totalVarReads = __pyx_t_8;

      /* "vcfutils.pyx":1571
 *             totalReverseVarReads = int(infoThisVar['NR'][0])
 *             totalVarReads = int(infoThisVar['TR'][0])
 *             totalReads = int(infoThisVar['TC'][0])             # <<<<<<<<<<<<<<
 *             totalFwdReads = int(infoThisVar['TCF'][0])
 *             totalRevReads = int(infoThisVar['TCR'][0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1571, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_TC); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1571, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_totalReads = __pyx_t_8;

      /* "vcfutils.pyx":1572
 *             totalVarReads = int(infoThisVar['TR'][0])
 *             totalReads = int(infoThisVar['TC'][0])
 *             totalFwdReads = int(infoThisVar['TCF'][0])             # <<<<<<<<<<<<<<
 *             totalRevReads = int(infoThisVar['TCR'][0])
 *             medMinQualBases = int(infoThisVar.get('MMLQ', [100])[0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1572, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_TCF); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_totalFwdReads = __pyx_t_8;

      /* "vcfutils.pyx":1573
 *             totalReads = int(infoThisVar['TC'][0])
 *             totalFwdReads = int(infoThisVar['TCF'][0])
 *             totalRevReads = int(infoThisVar['TCR'][0])             # <<<<<<<<<<<<<<
 *             medMinQualBases = int(infoThisVar.get('MMLQ', [100])[0])
 *             thisQual = int(infoThisVar.get('PP', [0])[0])
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1573, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_TCR); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_totalRevReads = __pyx_t_8;

      /* "vcfutils.pyx":1574
 *             totalFwdReads = int(infoThisVar['TCF'][0])
 *             totalRevReads = int(infoThisVar['TCR'][0])
 *             medMinQualBases = int(infoThisVar.get('MMLQ', [100])[0])             # <<<<<<<<<<<<<<
 *             thisQual = int(infoThisVar.get('PP', [0])[0])
 * 
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
        __PYX_ERR(0, 1574, __pyx_L1_error)
      }
      __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_int_100);
      __Pyx_GIVEREF(__pyx_int_100);
      PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_100);
      __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_v_infoThisVar, __pyx_n_s_MMLQ, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_medMinQualBases = __pyx_t_8;

      /* "vcfutils.pyx":1575
 *             totalRevReads = int(infoThisVar['TCR'][0])
 *             medMinQualBases = int(infoThisVar.get('MMLQ', [100])[0])
 *             thisQual = int(infoThisVar.get('PP', [0])[0])             # <<<<<<<<<<<<<<
 * 
 *             if thisQual > bestQual:
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
        __PYX_ERR(0, 1575, __pyx_L1_error)
      }
      __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_int_0);
      __pyx_t_12 = __Pyx_PyDict_GetItemDefault(__pyx_v_infoThisVar, __pyx_n_s_PP, __pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1575, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1575, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_thisQual = __pyx_t_8;

      /* "vcfutils.pyx":1577
 *             thisQual = int(infoThisVar.get('PP', [0])[0])
 * 
 *             if thisQual > bestQual:             # <<<<<<<<<<<<<<
 *                 bestQual = thisQual
 * 
 */
      __pyx_t_10 = ((__pyx_v_thisQual > __pyx_v_bestQual) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1578
 * 
 *             if thisQual > bestQual:
 *                 bestQual = thisQual             # <<<<<<<<<<<<<<
 * 
 *             if medMinQualBases < badReadsThreshold:
 */
        __pyx_v_bestQual = __pyx_v_thisQual;

        /* "vcfutils.pyx":1577
 *             thisQual = int(infoThisVar.get('PP', [0])[0])
 * 
 *             if thisQual > bestQual:             # <<<<<<<<<<<<<<
 *                 bestQual = thisQual
 * 
 */
      }

      /* "vcfutils.pyx":1580
 *                 bestQual = thisQual
 * 
 *             if medMinQualBases < badReadsThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsFailingMMLQFilter += 1
 * 
 */
      __pyx_t_10 = ((__pyx_v_medMinQualBases < __pyx_v_badReadsThreshold) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1581
 * 
 *             if medMinQualBases < badReadsThreshold:
 *                 nVarsFailingMMLQFilter += 1             # <<<<<<<<<<<<<<
 * 
 *             abPVal = float(infoThisVar['ABPV'][0])
 */
        __pyx_v_nVarsFailingMMLQFilter = (__pyx_v_nVarsFailingMMLQFilter + 1);

        /* "vcfutils.pyx":1580
 *                 bestQual = thisQual
 * 
 *             if medMinQualBases < badReadsThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsFailingMMLQFilter += 1
 * 
 */
      }

      /* "vcfutils.pyx":1583
 *                 nVarsFailingMMLQFilter += 1
 * 
 *             abPVal = float(infoThisVar['ABPV'][0])             # <<<<<<<<<<<<<<
 *             sbPVal = float(infoThisVar['SbPval'][0])
 * 
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1583, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_ABPV); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_12, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_abPVal = __pyx_t_3;

      /* "vcfutils.pyx":1584
 * 
 *             abPVal = float(infoThisVar['ABPV'][0])
 *             sbPVal = float(infoThisVar['SbPval'][0])             # <<<<<<<<<<<<<<
 * 
 *             if QD < qdThreshold:
 */
      if (unlikely(__pyx_v_infoThisVar == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1584, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_infoThisVar, __pyx_n_s_SbPval); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_AsDouble(__pyx_t_12); if (unlikely(__pyx_t_3 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_v_sbPVal = __pyx_t_3;

      /* "vcfutils.pyx":1586
 *             sbPVal = float(infoThisVar['SbPval'][0])
 * 
 *             if QD < qdThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsQD += 1
 * 
 */
      __pyx_t_10 = ((__pyx_v_QD < __pyx_v_qdThreshold) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1587
 * 
 *             if QD < qdThreshold:
 *                 nVarsQD += 1             # <<<<<<<<<<<<<<
 * 
 *             if hapScore > hapScoreThreshold:
 */
        __pyx_v_nVarsQD = (__pyx_v_nVarsQD + 1);

        /* "vcfutils.pyx":1586
 *             sbPVal = float(infoThisVar['SbPval'][0])
 * 
 *             if QD < qdThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsQD += 1
 * 
 */
      }

      /* "vcfutils.pyx":1589
 *                 nVarsQD += 1
 * 
 *             if hapScore > hapScoreThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsHapScore += 1
 * 
 */
      __pyx_t_10 = ((__pyx_v_hapScore > __pyx_v_hapScoreThreshold) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1590
 * 
 *             if hapScore > hapScoreThreshold:
 *                 nVarsHapScore += 1             # <<<<<<<<<<<<<<
 * 
 *             if totalReads > 0 and abPVal < abThreshold:
 */
        __pyx_v_nVarsHapScore = (__pyx_v_nVarsHapScore + 1);

        /* "vcfutils.pyx":1589
 *                 nVarsQD += 1
 * 
 *             if hapScore > hapScoreThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsHapScore += 1
 * 
 */
      }

      /* "vcfutils.pyx":1592
 *                 nVarsHapScore += 1
 * 
 *             if totalReads > 0 and abPVal < abThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsAB += 1
 * 
 */
      __pyx_t_13 = ((__pyx_v_totalReads > 0) != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_10 = __pyx_t_13;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_13 = ((__pyx_v_abPVal < __pyx_v_abThreshold) != 0);
      __pyx_t_10 = __pyx_t_13;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1593
 * 
 *             if totalReads > 0 and abPVal < abThreshold:
 *                 nVarsAB += 1             # <<<<<<<<<<<<<<
 * 
 *             if sbPVal < sbThreshold:
 */
        __pyx_v_nVarsAB = (__pyx_v_nVarsAB + 1);

        /* "vcfutils.pyx":1592
 *                 nVarsHapScore += 1
 * 
 *             if totalReads > 0 and abPVal < abThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsAB += 1
 * 
 */
      }

      /* "vcfutils.pyx":1595
 *                 nVarsAB += 1
 * 
 *             if sbPVal < sbThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsSB += 1
 * 
 */
      __pyx_t_10 = ((__pyx_v_sbPVal < __pyx_v_sbThreshold) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1596
 * 
 *             if sbPVal < sbThreshold:
 *                 nVarsSB += 1             # <<<<<<<<<<<<<<
 * 
 *             if RMSMQ < rmsmqThreshold:
 */
        __pyx_v_nVarsSB = (__pyx_v_nVarsSB + 1);

        /* "vcfutils.pyx":1595
 *                 nVarsAB += 1
 * 
 *             if sbPVal < sbThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsSB += 1
 * 
 */
      }

      /* "vcfutils.pyx":1598
 *                 nVarsSB += 1
 * 
 *             if RMSMQ < rmsmqThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsRMSMQ += 1
 * 
 */
      __pyx_t_10 = ((__pyx_v_RMSMQ < __pyx_v_rmsmqThreshold) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1599
 * 
 *             if RMSMQ < rmsmqThreshold:
 *                 nVarsRMSMQ += 1             # <<<<<<<<<<<<<<
 * 
 *             if failsSCFilter:
 */
        __pyx_v_nVarsRMSMQ = (__pyx_v_nVarsRMSMQ + 1);

        /* "vcfutils.pyx":1598
 *                 nVarsSB += 1
 * 
 *             if RMSMQ < rmsmqThreshold:             # <<<<<<<<<<<<<<
 *                 nVarsRMSMQ += 1
 * 
 */
      }

      /* "vcfutils.pyx":1601
 *                 nVarsRMSMQ += 1
 * 
 *             if failsSCFilter:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('SC')
 * 
 */
      __pyx_t_10 = (__pyx_v_failsSCFilter != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1602
 * 
 *             if failsSCFilter:
 *                 FILTER[v].append('SC')             # <<<<<<<<<<<<<<
 * 
 *         for v in varsAtPos:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_SC); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1602, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1601
 *                 nVarsRMSMQ += 1
 * 
 *             if failsSCFilter:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('SC')
 * 
 */
      }

      /* "vcfutils.pyx":1560
 *             failsSCFilter = 0
 * 
 *         for v in varsAtPos:             # <<<<<<<<<<<<<<
 * 
 *             FILTER[v] = []
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "vcfutils.pyx":1604
 *                 FILTER[v].append('SC')
 * 
 *         for v in varsAtPos:             # <<<<<<<<<<<<<<
 * 
 *             if nVarsQD == nVars:
 */
    if (likely(PyList_CheckExact(__pyx_v_varsAtPos)) || PyTuple_CheckExact(__pyx_v_varsAtPos)) {
      __pyx_t_6 = __pyx_v_varsAtPos; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_varsAtPos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1604, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_12 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_12); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1604, __pyx_L1_error)
          #else
          __pyx_t_12 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_12); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1604, __pyx_L1_error)
          #else
          __pyx_t_12 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          #endif
        }
      } else {
        __pyx_t_12 = __pyx_t_11(__pyx_t_6);
        if (unlikely(!__pyx_t_12)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1604, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_12);
      }
      if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_7variant_Variant))))) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_v, ((struct __pyx_obj_7variant_Variant *)__pyx_t_12));
      __pyx_t_12 = 0;

      /* "vcfutils.pyx":1606
 *         for v in varsAtPos:
 * 
 *             if nVarsQD == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('QD')
 * 
 */
      __pyx_t_10 = ((__pyx_v_nVarsQD == __pyx_v_nVars) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1607
 * 
 *             if nVarsQD == nVars:
 *                 FILTER[v].append('QD')             # <<<<<<<<<<<<<<
 * 
 *             if nVarsHapScore == nVars:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1607, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_QD); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1607, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1606
 *         for v in varsAtPos:
 * 
 *             if nVarsQD == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('QD')
 * 
 */
      }

      /* "vcfutils.pyx":1609
 *                 FILTER[v].append('QD')
 * 
 *             if nVarsHapScore == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('HapScore')
 * 
 */
      __pyx_t_10 = ((__pyx_v_nVarsHapScore == __pyx_v_nVars) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1610
 * 
 *             if nVarsHapScore == nVars:
 *                 FILTER[v].append('HapScore')             # <<<<<<<<<<<<<<
 * 
 *             if nVarsRMSMQ == nVars:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1610, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_HapScore); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1610, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1609
 *                 FILTER[v].append('QD')
 * 
 *             if nVarsHapScore == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('HapScore')
 * 
 */
      }

      /* "vcfutils.pyx":1612
 *                 FILTER[v].append('HapScore')
 * 
 *             if nVarsRMSMQ == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('MQ')
 * 
 */
      __pyx_t_10 = ((__pyx_v_nVarsRMSMQ == __pyx_v_nVars) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1613
 * 
 *             if nVarsRMSMQ == nVars:
 *                 FILTER[v].append('MQ')             # <<<<<<<<<<<<<<
 * 
 *             if nVarsSB == nVars:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_MQ); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1612
 *                 FILTER[v].append('HapScore')
 * 
 *             if nVarsRMSMQ == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('MQ')
 * 
 */
      }

      /* "vcfutils.pyx":1615
 *                 FILTER[v].append('MQ')
 * 
 *             if nVarsSB == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('strandBias')
 * 
 */
      __pyx_t_10 = ((__pyx_v_nVarsSB == __pyx_v_nVars) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1616
 * 
 *             if nVarsSB == nVars:
 *                 FILTER[v].append('strandBias')             # <<<<<<<<<<<<<<
 * 
 *             if nVarsAB == nVars:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_strandBias); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1616, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1615
 *                 FILTER[v].append('MQ')
 * 
 *             if nVarsSB == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('strandBias')
 * 
 */
      }

      /* "vcfutils.pyx":1618
 *                 FILTER[v].append('strandBias')
 * 
 *             if nVarsAB == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('alleleBias')
 * 
 */
      __pyx_t_10 = ((__pyx_v_nVarsAB == __pyx_v_nVars) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1619
 * 
 *             if nVarsAB == nVars:
 *                 FILTER[v].append('alleleBias')             # <<<<<<<<<<<<<<
 * 
 *             if nVarsFailingMMLQFilter == nVars or BRF >= filteredReadsFrac:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_alleleBias); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1619, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1618
 *                 FILTER[v].append('strandBias')
 * 
 *             if nVarsAB == nVars:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('alleleBias')
 * 
 */
      }

      /* "vcfutils.pyx":1621
 *                 FILTER[v].append('alleleBias')
 * 
 *             if nVarsFailingMMLQFilter == nVars or BRF >= filteredReadsFrac:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('badReads')
 * 
 */
      __pyx_t_13 = ((__pyx_v_nVarsFailingMMLQFilter == __pyx_v_nVars) != 0);
      if (!__pyx_t_13) {
      } else {
        __pyx_t_10 = __pyx_t_13;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_13 = ((__pyx_v_BRF >= __pyx_v_filteredReadsFrac) != 0);
      __pyx_t_10 = __pyx_t_13;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1622
 * 
 *             if nVarsFailingMMLQFilter == nVars or BRF >= filteredReadsFrac:
 *                 FILTER[v].append('badReads')             # <<<<<<<<<<<<<<
 * 
 *             if bestQual < 20:
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1622, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_badReads); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1622, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1621
 *                 FILTER[v].append('alleleBias')
 * 
 *             if nVarsFailingMMLQFilter == nVars or BRF >= filteredReadsFrac:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('badReads')
 * 
 */
      }

      /* "vcfutils.pyx":1624
 *                 FILTER[v].append('badReads')
 * 
 *             if bestQual < 20:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('Q20')
 * 
 */
      __pyx_t_10 = ((__pyx_v_bestQual < 20) != 0);
      if (__pyx_t_10) {

        /* "vcfutils.pyx":1625
 * 
 *             if bestQual < 20:
 *                 FILTER[v].append('Q20')             # <<<<<<<<<<<<<<
 * 
 *     return FILTER
 */
        __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_FILTER, ((PyObject *)__pyx_v_v)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1625, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = __Pyx_PyObject_Append(__pyx_t_12, __pyx_n_s_Q20); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1625, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "vcfutils.pyx":1624
 *                 FILTER[v].append('badReads')
 * 
 *             if bestQual < 20:             # <<<<<<<<<<<<<<
 *                 FILTER[v].append('Q20')
 * 
 */
      }

      /* "vcfutils.pyx":1604
 *                 FILTER[v].append('SC')
 * 
 *         for v in varsAtPos:             # <<<<<<<<<<<<<<
 * 
 *             if nVarsQD == nVars:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1627
 *                 FILTER[v].append('Q20')
 * 
 *     return FILTER             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_FILTER);
  __pyx_r = __pyx_v_FILTER;
  goto __pyx_L0;

  /* "vcfutils.pyx":1502
 * ###################################################################################################
 * 
 * cdef dict vcfFILTER(list genotypeCalls, list haplotypes, dict vcfInfo, dict varsByPos, options):             # <<<<<<<<<<<<<<
 *     """
 *     FILTER field for vcf output, two level dictionary of variant - info field - value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("vcfutils.vcfFILTER", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_FILTER);
  __Pyx_XDECREF(__pyx_v_infoThisVar);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_varsAtPos);
  __Pyx_XDECREF(__pyx_v_sequence);
  __Pyx_XDECREF(__pyx_v_totalForwardVarReads);
  __Pyx_XDECREF(__pyx_v_totalReverseVarReads);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "htslibWrapper.pxd":250
 * 
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":251
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 16) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":250
 * 
 * # And here are accessor functions for the bit-fields
 * cdef inline int Read_IsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":253
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsPaired(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":254
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 1) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":253
 *     return ( (theRead.bitFlag & BAM_FREVERSE) != 0)
 * 
 * cdef inline int Read_IsPaired(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":256
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsProperPair(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":257
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 2) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":256
 *     return ( (theRead.bitFlag & BAM_FPAIRED) != 0)
 * 
 * cdef inline int Read_IsProperPair(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":259
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsDuplicate(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":260
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x400) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":259
 *     return ( (theRead.bitFlag & BAM_FPROPER_PAIR) != 0)
 * 
 * cdef inline int Read_IsDuplicate(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":262
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":263
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 4) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":262
 *     return ( (theRead.bitFlag & BAM_FDUP) != 0)
 * 
 * cdef inline int Read_IsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":265
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsUnmapped(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":266
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 8) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":265
 *     return ( (theRead.bitFlag & BAM_FUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsUnmapped(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":268
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_MateIsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":269
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 32) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":268
 *     return ( (theRead.bitFlag & BAM_FMUNMAP) != 0)
 * 
 * cdef inline int Read_MateIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":271
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsQCFail(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":272
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x200) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":271
 *     return ( (theRead.bitFlag & BAM_FMREVERSE) != 0)
 * 
 * cdef inline int Read_IsQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":274
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsReadOne(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":275
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 64) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":274
 *     return ( (theRead.bitFlag & BAM_FQCFAIL) != 0)
 * 
 * cdef inline int Read_IsReadOne(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":277
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsSecondaryAlignment(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":278
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x100) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":277
 *     return ( (theRead.bitFlag & BAM_FREAD1) != 0)
 * 
 * cdef inline int Read_IsSecondaryAlignment(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":280
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_IsCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":281
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_r = ((__pyx_v_theRead->bitFlag & 0x800) != 0);
  goto __pyx_L0;

  /* "htslibWrapper.pxd":280
 *     return ( (theRead.bitFlag & BAM_FSECONDARY) != 0)
 * 
 * cdef inline int Read_IsCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "htslibWrapper.pxd":283
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_SetIsNotReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":284
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag &= (~BAM_FREVERSE)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag & (~16));

  /* "htslibWrapper.pxd":283
 *     return ( (theRead.bitFlag & BAM_FCOMPRESSED) != 0)
 * 
 * cdef inline int Read_SetIsNotReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "htslibWrapper.pxd":286
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 */

static CYTHON_INLINE int __pyx_f_13htslibWrapper_Read_SetIsReverse(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {
  int __pyx_r;

  /* "htslibWrapper.pxd":287
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FREVERSE             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 16);

  /* "htslibWrapper.pxd":286
 *     theRead.bitFlag &= (~BAM_FREVERSE)
 * 
 * cdef inline int Read_SetIsReverse(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  return __pyx_r;
}

/* "htslibWrapper.pxd":289
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetQCFail(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":290
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FQCFAIL             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 0x200);

  /* "htslibWrapper.pxd":289
 *     theRead.bitFlag |= BAM_FREVERSE
 * 
 * cdef inline void Read_SetQCFail(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 */

  /* function exit code */
}

/* "htslibWrapper.pxd":292
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":293
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag |= BAM_FCOMPRESSED             # <<<<<<<<<<<<<<
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag | 0x800);

  /* "htslibWrapper.pxd":292
 *     theRead.bitFlag |= BAM_FQCFAIL
 * 
 * cdef inline void Read_SetCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 */

  /* function exit code */
}

/* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

static CYTHON_INLINE void __pyx_f_13htslibWrapper_Read_SetUnCompressed(__pyx_t_13htslibWrapper_cAlignedRead *__pyx_v_theRead) {

  /* "htslibWrapper.pxd":296
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_theRead->bitFlag = (__pyx_v_theRead->bitFlag & (~0x800));

  /* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

  /* function exit code */
}

static struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *__pyx_freelist_8vcfutils___pyx_scope_struct__trimLeftPadding[8];
static int __pyx_freecount_8vcfutils___pyx_scope_struct__trimLeftPadding = 0;

static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct__trimLeftPadding(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8vcfutils___pyx_scope_struct__trimLeftPadding > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding)))) {
    o = (PyObject*)__pyx_freelist_8vcfutils___pyx_scope_struct__trimLeftPadding[--__pyx_freecount_8vcfutils___pyx_scope_struct__trimLeftPadding];
    memset(o, 0, sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8vcfutils___pyx_scope_struct__trimLeftPadding(PyObject *o) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alt);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8vcfutils___pyx_scope_struct__trimLeftPadding < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding)))) {
    __pyx_freelist_8vcfutils___pyx_scope_struct__trimLeftPadding[__pyx_freecount_8vcfutils___pyx_scope_struct__trimLeftPadding++] = ((struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8vcfutils___pyx_scope_struct__trimLeftPadding(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)o;
  if (p->__pyx_v_alt) {
    e = (*v)(p->__pyx_v_alt, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_8vcfutils___pyx_scope_struct__trimLeftPadding(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding *)o;
  tmp = ((PyObject*)p->__pyx_v_alt);
  p->__pyx_v_alt = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding = {
  PyVarObject_HEAD_INIT(0, 0)
  "vcfutils.__pyx_scope_struct__trimLeftPadding", /*tp_name*/
  sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct__trimLeftPadding), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8vcfutils___pyx_scope_struct__trimLeftPadding, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8vcfutils___pyx_scope_struct__trimLeftPadding, /*tp_traverse*/
  __pyx_tp_clear_8vcfutils___pyx_scope_struct__trimLeftPadding, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8vcfutils___pyx_scope_struct__trimLeftPadding, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *__pyx_freelist_8vcfutils___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_8vcfutils___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8vcfutils___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_8vcfutils___pyx_scope_struct_1_genexpr[--__pyx_freecount_8vcfutils___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8vcfutils___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_allele);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8vcfutils___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_8vcfutils___pyx_scope_struct_1_genexpr[__pyx_freecount_8vcfutils___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8vcfutils___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_allele) {
    e = (*v)(p->__pyx_v_allele, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_8vcfutils___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "vcfutils.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8vcfutils___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8vcfutils___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8vcfutils___pyx_scope_struct_1_genexpr, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *__pyx_freelist_8vcfutils___pyx_scope_struct_2_genexpr[8];
static int __pyx_freecount_8vcfutils___pyx_scope_struct_2_genexpr = 0;

static PyObject *__pyx_tp_new_8vcfutils___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8vcfutils___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_freelist_8vcfutils___pyx_scope_struct_2_genexpr[--__pyx_freecount_8vcfutils___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_8vcfutils___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_allele);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8vcfutils___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr)))) {
    __pyx_freelist_8vcfutils___pyx_scope_struct_2_genexpr[__pyx_freecount_8vcfutils___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_8vcfutils___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_allele) {
    e = (*v)(p->__pyx_v_allele, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_8vcfutils___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "vcfutils.__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_8vcfutils___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8vcfutils___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_8vcfutils___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8vcfutils___pyx_scope_struct_2_genexpr, /*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*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

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

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_vcfutils(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_vcfutils},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "vcfutils",
    __pyx_k_Utility_code_for_Platypus_This, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 0, 1, 0},
  {&__pyx_kp_s_0f, __pyx_k_0f, sizeof(__pyx_k_0f), 0, 0, 1, 0},
  {&__pyx_kp_s_1_4f, __pyx_k_1_4f, sizeof(__pyx_k_1_4f), 0, 0, 1, 0},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_ABPV, __pyx_k_ABPV, sizeof(__pyx_k_ABPV), 0, 0, 1, 1},
  {&__pyx_n_s_Assembler, __pyx_k_Assembler, sizeof(__pyx_k_Assembler), 0, 0, 1, 1},
  {&__pyx_n_s_BRF, __pyx_k_BRF, sizeof(__pyx_k_BRF), 0, 0, 1, 1},
  {&__pyx_kp_s_Binomial_P_value_for_strand_bias, __pyx_k_Binomial_P_value_for_strand_bias, sizeof(__pyx_k_Binomial_P_value_for_strand_bias), 0, 0, 1, 0},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_END, __pyx_k_END, sizeof(__pyx_k_END), 0, 0, 1, 1},
  {&__pyx_kp_s_End_position_of_calling_window, __pyx_k_End_position_of_calling_window, sizeof(__pyx_k_End_position_of_calling_window), 0, 0, 1, 0},
  {&__pyx_kp_s_End_position_of_reference_call_b, __pyx_k_End_position_of_reference_call_b, sizeof(__pyx_k_End_position_of_reference_call_b), 0, 0, 1, 0},
  {&__pyx_kp_s_Estimated_population_frequency_o, __pyx_k_Estimated_population_frequency_o, sizeof(__pyx_k_Estimated_population_frequency_o), 0, 0, 1, 0},
  {&__pyx_n_s_FORMAT, __pyx_k_FORMAT, sizeof(__pyx_k_FORMAT), 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_File, __pyx_k_File, sizeof(__pyx_k_File), 0, 0, 1, 1},
  {&__pyx_kp_s_Fisher_s_exact_test_for_strand_b, __pyx_k_Fisher_s_exact_test_for_strand_b, sizeof(__pyx_k_Fisher_s_exact_test_for_strand_b), 0, 0, 1, 0},
  {&__pyx_n_s_Flag, __pyx_k_Flag, sizeof(__pyx_k_Flag), 0, 0, 1, 1},
  {&__pyx_kp_s_Flanking_sequence_contains_homop, __pyx_k_Flanking_sequence_contains_homop, sizeof(__pyx_k_Flanking_sequence_contains_homop), 0, 0, 1, 0},
  {&__pyx_n_s_Float, __pyx_k_Float, sizeof(__pyx_k_Float), 0, 0, 1, 1},
  {&__pyx_kp_s_Fraction_of_reads_around_this_va, __pyx_k_Fraction_of_reads_around_this_va, sizeof(__pyx_k_Fraction_of_reads_around_this_va), 0, 0, 1, 0},
  {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 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_kp_s_GT_GL_GOF_GQ_NR_NV, __pyx_k_GT_GL_GOF_GQ_NR_NV, sizeof(__pyx_k_GT_GL_GOF_GQ_NR_NV), 0, 0, 1, 0},
  {&__pyx_kp_s_GT_GL_NR_NV1_NV2, __pyx_k_GT_GL_NR_NV1_NV2, sizeof(__pyx_k_GT_GL_NR_NV1_NV2), 0, 0, 1, 0},
  {&__pyx_kp_s_Genomic_sequence_10_bases_either, __pyx_k_Genomic_sequence_10_bases_either, sizeof(__pyx_k_Genomic_sequence_10_bases_either), 0, 0, 1, 0},
  {&__pyx_kp_s_Genotype_log10_likelihoods_for_A, __pyx_k_Genotype_log10_likelihoods_for_A, sizeof(__pyx_k_Genotype_log10_likelihoods_for_A), 0, 0, 1, 0},
  {&__pyx_kp_s_Genotype_quality_as_phred_score, __pyx_k_Genotype_quality_as_phred_score, sizeof(__pyx_k_Genotype_quality_as_phred_score), 0, 0, 1, 0},
  {&__pyx_kp_s_Goodness_of_fit_value, __pyx_k_Goodness_of_fit_value, sizeof(__pyx_k_Goodness_of_fit_value), 0, 0, 1, 0},
  {&__pyx_n_s_HLATyping, __pyx_k_HLATyping, sizeof(__pyx_k_HLATyping), 0, 0, 1, 1},
  {&__pyx_n_s_HP, __pyx_k_HP, sizeof(__pyx_k_HP), 0, 0, 1, 1},
  {&__pyx_n_s_HapScore, __pyx_k_HapScore, sizeof(__pyx_k_HapScore), 0, 0, 1, 1},
  {&__pyx_kp_s_Haplotype_score_measuring_the_nu, __pyx_k_Haplotype_score_measuring_the_nu, sizeof(__pyx_k_Haplotype_score_measuring_the_nu), 0, 0, 1, 0},
  {&__pyx_kp_s_Haps_are_s, __pyx_k_Haps_are_s, sizeof(__pyx_k_Haps_are_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Homopolymer_run_length_around_va, __pyx_k_Homopolymer_run_length_around_va, sizeof(__pyx_k_Homopolymer_run_length_around_va), 0, 0, 1, 0},
  {&__pyx_kp_s_Individual_d_d_d_d_d, __pyx_k_Individual_d_d_d_d_d, sizeof(__pyx_k_Individual_d_d_d_d_d), 0, 0, 1, 0},
  {&__pyx_n_s_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 0, 1, 1},
  {&__pyx_kp_s_Lengths_are_s, __pyx_k_Lengths_are_s, sizeof(__pyx_k_Lengths_are_s), 0, 0, 1, 0},
  {&__pyx_n_s_Log, __pyx_k_Log, sizeof(__pyx_k_Log), 0, 0, 1, 1},
  {&__pyx_kp_s_Logging_mutated_sequences, __pyx_k_Logging_mutated_sequences, sizeof(__pyx_k_Logging_mutated_sequences), 0, 0, 1, 0},
  {&__pyx_n_s_MGOF, __pyx_k_MGOF, sizeof(__pyx_k_MGOF), 0, 0, 1, 1},
  {&__pyx_n_s_MMLQ, __pyx_k_MMLQ, sizeof(__pyx_k_MMLQ), 0, 0, 1, 1},
  {&__pyx_n_s_MQ, __pyx_k_MQ, sizeof(__pyx_k_MQ), 0, 0, 1, 1},
  {&__pyx_kp_s_Mann_Whitney_Rank_sum_test_for_d, __pyx_k_Mann_Whitney_Rank_sum_test_for_d, sizeof(__pyx_k_Mann_Whitney_Rank_sum_test_for_d), 0, 0, 1, 0},
  {&__pyx_kp_s_Median_minimum_base_quality_for, __pyx_k_Median_minimum_base_quality_for, sizeof(__pyx_k_Median_minimum_base_quality_for), 0, 0, 1, 0},
  {&__pyx_n_s_NF, __pyx_k_NF, sizeof(__pyx_k_NF), 0, 0, 1, 1},
  {&__pyx_n_s_NR, __pyx_k_NR, sizeof(__pyx_k_NR), 0, 0, 1, 1},
  {&__pyx_n_s_NV, __pyx_k_NV, sizeof(__pyx_k_NV), 0, 0, 1, 1},
  {&__pyx_kp_s_NVariants_s, __pyx_k_NVariants_s, sizeof(__pyx_k_NVariants_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Number_of_reads_containing_varia, __pyx_k_Number_of_reads_containing_varia, sizeof(__pyx_k_Number_of_reads_containing_varia), 0, 0, 1, 0},
  {&__pyx_kp_s_Number_of_reads_covering_variant, __pyx_k_Number_of_reads_covering_variant, sizeof(__pyx_k_Number_of_reads_covering_variant), 0, 0, 1, 0},
  {&__pyx_kp_s_Out_vcf_writing, __pyx_k_Out_vcf_writing, sizeof(__pyx_k_Out_vcf_writing), 0, 0, 1, 0},
  {&__pyx_n_s_PASS, __pyx_k_PASS, sizeof(__pyx_k_PASS), 0, 0, 1, 1},
  {&__pyx_n_s_PP, __pyx_k_PP, sizeof(__pyx_k_PP), 0, 0, 1, 1},
  {&__pyx_n_s_Platypus, __pyx_k_Platypus, sizeof(__pyx_k_Platypus), 0, 0, 1, 1},
  {&__pyx_kp_s_Posterior_probability_phred_scal, __pyx_k_Posterior_probability_phred_scal, sizeof(__pyx_k_Posterior_probability_phred_scal), 0, 0, 1, 0},
  {&__pyx_n_s_Q20, __pyx_k_Q20, sizeof(__pyx_k_Q20), 0, 0, 1, 1},
  {&__pyx_n_s_QD, __pyx_k_QD, sizeof(__pyx_k_QD), 0, 0, 1, 1},
  {&__pyx_n_s_QualDepth, __pyx_k_QualDepth, sizeof(__pyx_k_QualDepth), 0, 0, 1, 1},
  {&__pyx_n_s_REFCALL, __pyx_k_REFCALL, sizeof(__pyx_k_REFCALL), 0, 0, 1, 1},
  {&__pyx_n_s_ReadPosRankSum, __pyx_k_ReadPosRankSum, sizeof(__pyx_k_ReadPosRankSum), 0, 0, 1, 1},
  {&__pyx_kp_s_Root_mean_square_mapping_quality, __pyx_k_Root_mean_square_mapping_quality, sizeof(__pyx_k_Root_mean_square_mapping_quality), 0, 0, 1, 0},
  {&__pyx_kp_s_Root_mean_square_of_mapping_qual, __pyx_k_Root_mean_square_of_mapping_qual, sizeof(__pyx_k_Root_mean_square_of_mapping_qual), 0, 0, 1, 0},
  {&__pyx_n_s_SC, __pyx_k_SC, sizeof(__pyx_k_SC), 0, 0, 1, 1},
  {&__pyx_n_s_START, __pyx_k_START, sizeof(__pyx_k_START), 0, 0, 1, 1},
  {&__pyx_kp_s_Sample_s_has_genotype_posterior, __pyx_k_Sample_s_has_genotype_posterior, sizeof(__pyx_k_Sample_s_has_genotype_posterior), 0, 0, 1, 0},
  {&__pyx_n_s_SbPval, __pyx_k_SbPval, sizeof(__pyx_k_SbPval), 0, 0, 1, 1},
  {&__pyx_kp_s_Size, __pyx_k_Size, sizeof(__pyx_k_Size), 0, 0, 1, 0},
  {&__pyx_n_s_Size_2, __pyx_k_Size_2, sizeof(__pyx_k_Size_2), 0, 0, 1, 1},
  {&__pyx_kp_s_Size_of_reference_call_block, __pyx_k_Size_of_reference_call_block, sizeof(__pyx_k_Size_of_reference_call_block), 0, 0, 1, 0},
  {&__pyx_kp_s_Skipping_output_for_call_s_s_s_s, __pyx_k_Skipping_output_for_call_s_s_s_s, sizeof(__pyx_k_Skipping_output_for_call_s_s_s_s), 0, 0, 1, 0},
  {&__pyx_n_s_Source, __pyx_k_Source, sizeof(__pyx_k_Source), 0, 0, 1, 1},
  {&__pyx_kp_s_Start_output_to_vcf, __pyx_k_Start_output_to_vcf, sizeof(__pyx_k_Start_output_to_vcf), 0, 0, 1, 0},
  {&__pyx_kp_s_Start_position_of_reference_call, __pyx_k_Start_position_of_reference_call, sizeof(__pyx_k_Start_position_of_reference_call), 0, 0, 1, 0},
  {&__pyx_kp_s_Starting_position_of_calling_win, __pyx_k_Starting_position_of_calling_win, sizeof(__pyx_k_Starting_position_of_calling_win), 0, 0, 1, 0},
  {&__pyx_n_s_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_TC, __pyx_k_TC, sizeof(__pyx_k_TC), 0, 0, 1, 1},
  {&__pyx_n_s_TCF, __pyx_k_TCF, sizeof(__pyx_k_TCF), 0, 0, 1, 1},
  {&__pyx_n_s_TCR, __pyx_k_TCR, sizeof(__pyx_k_TCR), 0, 0, 1, 1},
  {&__pyx_n_s_TR, __pyx_k_TR, sizeof(__pyx_k_TR), 0, 0, 1, 1},
  {&__pyx_kp_s_This_line_represents_a_homozygou, __pyx_k_This_line_represents_a_homozygou, sizeof(__pyx_k_This_line_represents_a_homozygou), 0, 0, 1, 0},
  {&__pyx_kp_s_Too_many_haplotypes_are_supporte, __pyx_k_Too_many_haplotypes_are_supporte, sizeof(__pyx_k_Too_many_haplotypes_are_supporte), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_coverage_at_this_locus, __pyx_k_Total_coverage_at_this_locus, sizeof(__pyx_k_Total_coverage_at_this_locus), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_forward_strand_coverage_at, __pyx_k_Total_forward_strand_coverage_at, sizeof(__pyx_k_Total_forward_strand_coverage_at), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_number_of_forward_reads_co, __pyx_k_Total_number_of_forward_reads_co, sizeof(__pyx_k_Total_number_of_forward_reads_co), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_number_of_reads_containing, __pyx_k_Total_number_of_reads_containing, sizeof(__pyx_k_Total_number_of_reads_containing), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_number_of_reverse_reads_co, __pyx_k_Total_number_of_reverse_reads_co, sizeof(__pyx_k_Total_number_of_reverse_reads_co), 0, 0, 1, 0},
  {&__pyx_kp_s_Total_reverse_strand_coverage_at, __pyx_k_Total_reverse_strand_coverage_at, sizeof(__pyx_k_Total_reverse_strand_coverage_at), 0, 0, 1, 0},
  {&__pyx_kp_s_Unfiltered_variant_info_is_s, __pyx_k_Unfiltered_variant_info_is_s, sizeof(__pyx_k_Unfiltered_variant_info_is_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unfiltered_variants_are_s, __pyx_k_Unfiltered_variants_are_s, sizeof(__pyx_k_Unfiltered_variants_are_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Unphased_genotypes, __pyx_k_Unphased_genotypes, sizeof(__pyx_k_Unphased_genotypes), 0, 0, 1, 0},
  {&__pyx_kp_s_Var_info_s, __pyx_k_Var_info_s, sizeof(__pyx_k_Var_info_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_fails_goodness_of_fit_te, __pyx_k_Variant_fails_goodness_of_fit_te, sizeof(__pyx_k_Variant_fails_goodness_of_fit_te), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_fails_strand_bias_filter, __pyx_k_Variant_fails_strand_bias_filter, sizeof(__pyx_k_Variant_fails_strand_bias_filter), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_frequency_is_lower_than, __pyx_k_Variant_frequency_is_lower_than, sizeof(__pyx_k_Variant_frequency_is_lower_than), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_quality_Read_depth_ratio, __pyx_k_Variant_quality_Read_depth_ratio, sizeof(__pyx_k_Variant_quality_Read_depth_ratio), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_quality_is_below_20, __pyx_k_Variant_quality_is_below_20, sizeof(__pyx_k_Variant_quality_is_below_20), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_quality_read_depth_for_t, __pyx_k_Variant_quality_read_depth_for_t, sizeof(__pyx_k_Variant_quality_read_depth_for_t), 0, 0, 1, 0},
  {&__pyx_kp_s_Variant_supported_only_by_reads, __pyx_k_Variant_supported_only_by_reads, sizeof(__pyx_k_Variant_supported_only_by_reads), 0, 0, 1, 0},
  {&__pyx_kp_s_Variants_fail_quality_depth_filt, __pyx_k_Variants_fail_quality_depth_filt, sizeof(__pyx_k_Variants_fail_quality_depth_filt), 0, 0, 1, 0},
  {&__pyx_kp_s_Variants_fail_sequence_context_f, __pyx_k_Variants_fail_sequence_context_f, sizeof(__pyx_k_Variants_fail_sequence_context_f), 0, 0, 1, 0},
  {&__pyx_n_s_WE, __pyx_k_WE, sizeof(__pyx_k_WE), 0, 0, 1, 1},
  {&__pyx_kp_s_WE_2, __pyx_k_WE_2, sizeof(__pyx_k_WE_2), 0, 0, 1, 0},
  {&__pyx_n_s_WS, __pyx_k_WS, sizeof(__pyx_k_WS), 0, 0, 1, 1},
  {&__pyx_kp_s_WS_2, __pyx_k_WS_2, sizeof(__pyx_k_WS_2), 0, 0, 1, 0},
  {&__pyx_kp_s_Was_this_variant_suggested_by_Pl, __pyx_k_Was_this_variant_suggested_by_Pl, sizeof(__pyx_k_Was_this_variant_suggested_by_Pl), 0, 0, 1, 0},
  {&__pyx_kp_s_Worst_goodness_of_fit_value_repo, __pyx_k_Worst_goodness_of_fit_value_repo, sizeof(__pyx_k_Worst_goodness_of_fit_value_repo), 0, 0, 1, 0},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
  {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_abThreshold, __pyx_k_abThreshold, sizeof(__pyx_k_abThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_alignScoreFile, __pyx_k_alignScoreFile, sizeof(__pyx_k_alignScoreFile), 0, 0, 1, 1},
  {&__pyx_n_s_allele, __pyx_k_allele, sizeof(__pyx_k_allele), 0, 0, 1, 1},
  {&__pyx_n_s_alleleBias, __pyx_k_alleleBias, sizeof(__pyx_k_alleleBias), 0, 0, 1, 1},
  {&__pyx_n_s_alt, __pyx_k_alt, sizeof(__pyx_k_alt), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_badReads, __pyx_k_badReads, sizeof(__pyx_k_badReads), 0, 0, 1, 1},
  {&__pyx_n_s_badReadsThreshold, __pyx_k_badReadsThreshold, sizeof(__pyx_k_badReadsThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_badReadsWindow, __pyx_k_badReadsWindow, sizeof(__pyx_k_badReadsWindow), 0, 0, 1, 1},
  {&__pyx_n_s_canonicalBases, __pyx_k_canonicalBases, sizeof(__pyx_k_canonicalBases), 0, 0, 1, 1},
  {&__pyx_n_s_chrom, __pyx_k_chrom, sizeof(__pyx_k_chrom), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_countOnlyExactIndelMatches, __pyx_k_countOnlyExactIndelMatches, sizeof(__pyx_k_countOnlyExactIndelMatches), 0, 0, 1, 1},
  {&__pyx_kp_s_cython_vcfutils_pyx, __pyx_k_cython_vcfutils_pyx, sizeof(__pyx_k_cython_vcfutils_pyx), 0, 0, 1, 0},
  {&__pyx_kp_s_d_d_s, __pyx_k_d_d_s, sizeof(__pyx_k_d_d_s), 0, 0, 1, 0},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
  {&__pyx_n_s_filteredReadsFrac, __pyx_k_filteredReadsFrac, sizeof(__pyx_k_filteredReadsFrac), 0, 0, 1, 1},
  {&__pyx_n_s_firstAltChars, __pyx_k_firstAltChars, sizeof(__pyx_k_firstAltChars), 0, 0, 1, 1},
  {&__pyx_n_s_firstRefChar, __pyx_k_firstRefChar, sizeof(__pyx_k_firstRefChar), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_getLogger, __pyx_k_getLogger, sizeof(__pyx_k_getLogger), 0, 0, 1, 1},
  {&__pyx_n_s_getfilter, __pyx_k_getfilter, sizeof(__pyx_k_getfilter), 0, 0, 1, 1},
  {&__pyx_n_s_hapScoreThreshold, __pyx_k_hapScoreThreshold, sizeof(__pyx_k_hapScoreThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_hp10, __pyx_k_hp10, sizeof(__pyx_k_hp10), 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_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_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_len, __pyx_k_len, sizeof(__pyx_k_len), 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_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_maxGOF, __pyx_k_maxGOF, sizeof(__pyx_k_maxGOF), 0, 0, 1, 1},
  {&__pyx_n_s_maxLenDiff, __pyx_k_maxLenDiff, sizeof(__pyx_k_maxLenDiff), 0, 0, 1, 1},
  {&__pyx_n_s_maxRefPos, __pyx_k_maxRefPos, sizeof(__pyx_k_maxRefPos), 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_minLenRefAlt, __pyx_k_minLenRefAlt, sizeof(__pyx_k_minLenRefAlt), 0, 0, 1, 1},
  {&__pyx_n_s_minMapQual, __pyx_k_minMapQual, sizeof(__pyx_k_minMapQual), 0, 0, 1, 1},
  {&__pyx_n_s_minPosterior, __pyx_k_minPosterior, sizeof(__pyx_k_minPosterior), 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_nReadsPerSample, __pyx_k_nReadsPerSample, sizeof(__pyx_k_nReadsPerSample), 0, 0, 1, 1},
  {&__pyx_n_s_nVarReadsPerSample, __pyx_k_nVarReadsPerSample, sizeof(__pyx_k_nVarReadsPerSample), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 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_outputRefCalls, __pyx_k_outputRefCalls, sizeof(__pyx_k_outputRefCalls), 0, 0, 1, 1},
  {&__pyx_n_s_outputSingleLineOfVCF, __pyx_k_outputSingleLineOfVCF, sizeof(__pyx_k_outputSingleLineOfVCF), 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_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_qdThreshold, __pyx_k_qdThreshold, sizeof(__pyx_k_qdThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_qual, __pyx_k_qual, sizeof(__pyx_k_qual), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1},
  {&__pyx_n_s_refName, __pyx_k_refName, sizeof(__pyx_k_refName), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_rmsmqThreshold, __pyx_k_rmsmqThreshold, sizeof(__pyx_k_rmsmqThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_n_s_sbThreshold, __pyx_k_sbThreshold, sizeof(__pyx_k_sbThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_scThreshold, __pyx_k_scThreshold, sizeof(__pyx_k_scThreshold), 0, 0, 1, 1},
  {&__pyx_n_s_secondAltChars, __pyx_k_secondAltChars, sizeof(__pyx_k_secondAltChars), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_sorted, __pyx_k_sorted, sizeof(__pyx_k_sorted), 0, 0, 1, 1},
  {&__pyx_n_s_strandBias, __pyx_k_strandBias, sizeof(__pyx_k_strandBias), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_trimLeftPadding, __pyx_k_trimLeftPadding, sizeof(__pyx_k_trimLeftPadding), 0, 0, 1, 1},
  {&__pyx_n_s_trimLeftPadding_locals_genexpr, __pyx_k_trimLeftPadding_locals_genexpr, sizeof(__pyx_k_trimLeftPadding_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_kp_s_varSource, __pyx_k_varSource, sizeof(__pyx_k_varSource), 0, 0, 1, 0},
  {&__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_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_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 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_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 207, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 409, __pyx_L1_error)
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 482, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 512, __pyx_L1_error)
  __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 661, __pyx_L1_error)
  __pyx_builtin_map = __Pyx_GetBuiltinName(__pyx_n_s_map); if (!__pyx_builtin_map) __PYX_ERR(0, 714, __pyx_L1_error)
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s_sorted); if (!__pyx_builtin_sorted) __PYX_ERR(0, 717, __pyx_L1_error)
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 810, __pyx_L1_error)
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 1473, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 1473, __pyx_L1_error)
  #endif
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 1496, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "vcfutils.pyx":435
 * 
 *             for haplotype in haplotypes:
 *                 logger.debug(str(haplotype.getMutatedSequence())[50:-50])             # <<<<<<<<<<<<<<
 * 
 *             logger.debug("Unfiltered variants are %s" %(sorted(variants)))
 */
  __pyx_slice_ = PySlice_New(__pyx_int_50, __pyx_int_neg_50, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);

  /* "vcfutils.pyx":833
 * 
 *             # Trim one base from ref and all alts, and adjust position
 *             ref, alt = ref[1:], [allele[1:] for allele in alt]             # <<<<<<<<<<<<<<
 *             vcfDataLine['pos'] += 1
 * 
 */
  __pyx_slice__8 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "vcfutils.pyx":1496
 * 
 *     cdef int lenSeq = len(sequence)
 *     cdef int nCharsFromTop2Bases = sum([x[0] for x in sorted( [(nChars,base) for base,nChars in counter.iteritems()], reverse=True)[0:2] ])             # <<<<<<<<<<<<<<
 *     cdef double SC = <double>(nCharsFromTop2Bases)/<double>(lenSeq)
 *     return SC
 */
  __pyx_slice__9 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__9)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__9);
  __Pyx_GIVEREF(__pyx_slice__9);

  /* "vcfutils.pyx":35
 * from htslibWrapper cimport Read_SetQCFail
 * 
 * logger = logging.getLogger("Log")             # <<<<<<<<<<<<<<
 * 
 * canonicalBases = set(["A", "C", "T", "G"])
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_Log); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "vcfutils.pyx":73
 * # Definititons for the individual and filter fields included in the header
 * vcfInfoSignature = {
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),             # <<<<<<<<<<<<<<
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 */
  __pyx_tuple__11 = PyTuple_Pack(6, __pyx_n_s_FR, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Estimated_population_frequency_o, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "vcfutils.pyx":74
 * vcfInfoSignature = {
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),             # <<<<<<<<<<<<<<
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 */
  __pyx_tuple__12 = PyTuple_Pack(6, __pyx_n_s_PP, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Posterior_probability_phred_scal, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "vcfutils.pyx":75
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 */
  __pyx_tuple__13 = PyTuple_Pack(6, __pyx_n_s_TC, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_Total_coverage_at_this_locus, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "vcfutils.pyx":76
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),             # <<<<<<<<<<<<<<
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 */
  __pyx_tuple__14 = PyTuple_Pack(6, __pyx_n_s_WS, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_Starting_position_of_calling_win, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "vcfutils.pyx":77
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),             # <<<<<<<<<<<<<<
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 */
  __pyx_tuple__15 = PyTuple_Pack(6, __pyx_n_s_WE, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_End_position_of_calling_window, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "vcfutils.pyx":78
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 */
  __pyx_tuple__16 = PyTuple_Pack(6, __pyx_n_s_TCR, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_Total_reverse_strand_coverage_at, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "vcfutils.pyx":79
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 */
  __pyx_tuple__17 = PyTuple_Pack(6, __pyx_n_s_TCF, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_Total_forward_strand_coverage_at, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "vcfutils.pyx":80
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 */
  __pyx_tuple__18 = PyTuple_Pack(6, __pyx_n_s_TR, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Total_number_of_reads_containing, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "vcfutils.pyx":81
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 */
  __pyx_tuple__19 = PyTuple_Pack(6, __pyx_n_s_NF, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Total_number_of_forward_reads_co, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "vcfutils.pyx":82
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 */
  __pyx_tuple__20 = PyTuple_Pack(6, __pyx_n_s_NR, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Total_number_of_reverse_reads_co, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "vcfutils.pyx":83
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),             # <<<<<<<<<<<<<<
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 */
  __pyx_tuple__21 = PyTuple_Pack(6, __pyx_n_s_MGOF, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Worst_goodness_of_fit_value_repo, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "vcfutils.pyx":84
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),             # <<<<<<<<<<<<<<
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 */
  __pyx_tuple__22 = PyTuple_Pack(6, __pyx_n_s_SC, __pyx_int_1, __pyx_int_1, __pyx_n_s_String, __pyx_kp_s_Genomic_sequence_10_bases_either, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "vcfutils.pyx":85
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),             # <<<<<<<<<<<<<<
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 */
  __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_HP, __pyx_int_1, __pyx_int_1, __pyx_n_s_Integer, __pyx_kp_s_Homopolymer_run_length_around_va, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "vcfutils.pyx":86
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),             # <<<<<<<<<<<<<<
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 */
  __pyx_tuple__24 = PyTuple_Pack(6, __pyx_n_s_BRF, __pyx_int_1, __pyx_int_1, __pyx_n_s_Float, __pyx_kp_s_Fraction_of_reads_around_this_va, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "vcfutils.pyx":87
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),             # <<<<<<<<<<<<<<
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 */
  __pyx_tuple__25 = PyTuple_Pack(6, __pyx_n_s_MMLQ, __pyx_int_1, __pyx_int_1, __pyx_n_s_Float, __pyx_kp_s_Median_minimum_base_quality_for, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "vcfutils.pyx":88
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),             # <<<<<<<<<<<<<<
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 */
  __pyx_tuple__26 = PyTuple_Pack(6, __pyx_n_s_QD, __pyx_int_1, __pyx_int_1, __pyx_n_s_Float, __pyx_kp_s_Variant_quality_read_depth_for_t, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "vcfutils.pyx":89
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),             # <<<<<<<<<<<<<<
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 */
  __pyx_tuple__27 = PyTuple_Pack(6, __pyx_n_s_Source, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_String, __pyx_kp_s_Was_this_variant_suggested_by_Pl, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "vcfutils.pyx":90
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 */
  __pyx_tuple__28 = PyTuple_Pack(6, __pyx_n_s_START, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Start_position_of_reference_call, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "vcfutils.pyx":91
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 */
  __pyx_tuple__29 = PyTuple_Pack(6, __pyx_n_s_END, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_End_position_of_reference_call_b, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "vcfutils.pyx":92
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 */
  __pyx_tuple__30 = PyTuple_Pack(6, __pyx_n_s_Size_2, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Size_of_reference_call_block, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "vcfutils.pyx":93
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),             # <<<<<<<<<<<<<<
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 */
  __pyx_tuple__31 = PyTuple_Pack(6, __pyx_n_s_HapScore, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Haplotype_score_measuring_the_nu, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "vcfutils.pyx":94
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),             # <<<<<<<<<<<<<<
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 */
  __pyx_tuple__32 = PyTuple_Pack(6, __pyx_n_s_MQ, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Root_mean_square_of_mapping_qual, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "vcfutils.pyx":95
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),             # <<<<<<<<<<<<<<
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 */
  __pyx_tuple__33 = PyTuple_Pack(6, __pyx_n_s_FS, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Fisher_s_exact_test_for_strand_b, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "vcfutils.pyx":96
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),             # <<<<<<<<<<<<<<
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 *     "ReadPosRankSum":vcf.FORMAT('ReadPosRankSum',1,".",'Float','Mann-Whitney Rank sum test for difference between in positions of variants in reads from ref and alt',-1),
 */
  __pyx_tuple__34 = PyTuple_Pack(6, __pyx_n_s_SbPval, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Binomial_P_value_for_strand_bias, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "vcfutils.pyx":98
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 *     "ReadPosRankSum":vcf.FORMAT('ReadPosRankSum',1,".",'Float','Mann-Whitney Rank sum test for difference between in positions of variants in reads from ref and alt',-1),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_tuple__35 = PyTuple_Pack(6, __pyx_n_s_ReadPosRankSum, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Mann_Whitney_Rank_sum_test_for_d, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "vcfutils.pyx":102
 * 
 * vcfFilterSignature = {
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),             # <<<<<<<<<<<<<<
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 */
  __pyx_tuple__36 = PyTuple_Pack(6, __pyx_n_s_alleleBias, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_frequency_is_lower_than, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "vcfutils.pyx":103
 * vcfFilterSignature = {
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),             # <<<<<<<<<<<<<<
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 */
  __pyx_tuple__37 = PyTuple_Pack(6, __pyx_n_s_strandBias, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_fails_strand_bias_filter, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "vcfutils.pyx":104
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),             # <<<<<<<<<<<<<<
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 */
  __pyx_tuple__38 = PyTuple_Pack(6, __pyx_n_s_badReads, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_supported_only_by_reads, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "vcfutils.pyx":105
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),             # <<<<<<<<<<<<<<
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 */
  __pyx_tuple__39 = PyTuple_Pack(6, __pyx_n_s_MQ, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Root_mean_square_mapping_quality, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "vcfutils.pyx":106
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),             # <<<<<<<<<<<<<<
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 */
  __pyx_tuple__40 = PyTuple_Pack(6, __pyx_n_s_Q20, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_quality_is_below_20, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "vcfutils.pyx":107
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),             # <<<<<<<<<<<<<<
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 */
  __pyx_tuple__41 = PyTuple_Pack(6, __pyx_n_s_HapScore, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Too_many_haplotypes_are_supporte, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "vcfutils.pyx":108
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),             # <<<<<<<<<<<<<<
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 */
  __pyx_tuple__42 = PyTuple_Pack(6, __pyx_n_s_QualDepth, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_quality_Read_depth_ratio, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "vcfutils.pyx":109
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),             # <<<<<<<<<<<<<<
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 */
  __pyx_tuple__43 = PyTuple_Pack(6, __pyx_n_s_GOF, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variant_fails_goodness_of_fit_te, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "vcfutils.pyx":110
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),             # <<<<<<<<<<<<<<
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 */
  __pyx_tuple__44 = PyTuple_Pack(6, __pyx_n_s_hp10, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Flanking_sequence_contains_homop, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "vcfutils.pyx":111
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),             # <<<<<<<<<<<<<<
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),
 */
  __pyx_tuple__45 = PyTuple_Pack(6, __pyx_n_s_REFCALL, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_This_line_represents_a_homozygou, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "vcfutils.pyx":112
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),             # <<<<<<<<<<<<<<
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),
 * }
 */
  __pyx_tuple__46 = PyTuple_Pack(6, __pyx_n_s_QD, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variants_fail_quality_depth_filt, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "vcfutils.pyx":113
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_tuple__47 = PyTuple_Pack(6, __pyx_n_s_SC, __pyx_int_1, __pyx_int_0, __pyx_n_s_Flag, __pyx_kp_s_Variants_fail_sequence_context_f, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "vcfutils.pyx":117
 * 
 * vcfFormatSignature = {
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),             # <<<<<<<<<<<<<<
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 */
  __pyx_tuple__48 = PyTuple_Pack(6, __pyx_n_s_GT, __pyx_int_1, __pyx_int_1, __pyx_n_s_String, __pyx_kp_s_Unphased_genotypes, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "vcfutils.pyx":118
 * vcfFormatSignature = {
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),             # <<<<<<<<<<<<<<
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 */
  __pyx_tuple__49 = PyTuple_Pack(6, __pyx_n_s_GL, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Genotype_log10_likelihoods_for_A, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "vcfutils.pyx":119
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),             # <<<<<<<<<<<<<<
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 */
  __pyx_tuple__50 = PyTuple_Pack(6, __pyx_n_s_GQ, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Genotype_quality_as_phred_score, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "vcfutils.pyx":120
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),             # <<<<<<<<<<<<<<
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),
 */
  __pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_s_GOF, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Float, __pyx_kp_s_Goodness_of_fit_value, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "vcfutils.pyx":121
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),             # <<<<<<<<<<<<<<
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),
 * }
 */
  __pyx_tuple__52 = PyTuple_Pack(6, __pyx_n_s_NR, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Number_of_reads_covering_variant, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "vcfutils.pyx":122
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __pyx_tuple__53 = PyTuple_Pack(6, __pyx_n_s_NV, __pyx_int_1, __pyx_kp_s__2, __pyx_n_s_Integer, __pyx_kp_s_Number_of_reads_containing_varia, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "vcfutils.pyx":127
 * ###################################################################################################
 * 
 * def outputSingleLineOfVCF(dict data, object outputFile, object vcfFile, options):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_tuple__54 = PyTuple_Pack(4, __pyx_n_s_data, __pyx_n_s_outputFile, __pyx_n_s_vcfFile, __pyx_n_s_options); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_vcfutils_pyx, __pyx_n_s_outputSingleLineOfVCF, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 127, __pyx_L1_error)

  /* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */
  __pyx_tuple__56 = PyTuple_Pack(13, __pyx_n_s_vcfDataLine, __pyx_n_s_ref, __pyx_n_s_alt, __pyx_n_s_minLenRefAlt, __pyx_n_s_maxLenDiff, __pyx_n_s_i, __pyx_n_s_firstAltChars, __pyx_n_s_secondAltChars, __pyx_n_s_firstRefChar, __pyx_n_s_allele, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);
  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cython_vcfutils_pyx, __pyx_n_s_trimLeftPadding, 796, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyList_Type_index.type = (PyObject*)&PyList_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_50 = PyInt_FromLong(-50); if (unlikely(!__pyx_int_neg_50)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("outputCallToVCF", (void (*)(void))__pyx_f_8vcfutils_outputCallToVCF, "void (PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, double *, double **, double **, int **, PyObject *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, PyObject *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("refAndAlt", (void (*)(void))__pyx_f_8vcfutils_refAndAlt, "PyObject *(char *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("vcfINFO", (void (*)(void))__pyx_f_8vcfutils_vcfINFO, "PyObject *(double *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *, struct __pyx_obj_9fastafile_FastaFile *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("vcfFILTER", (void (*)(void))__pyx_f_8vcfutils_vcfFILTER, "PyObject *(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("outputHLACallToVCF", (void (*)(void))__pyx_f_8vcfutils_outputHLACallToVCF, "void (PyObject *, PyObject *, int, struct __pyx_obj_9fastafile_FastaFile *, PyObject *, PyObject *, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  __pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding.tp_dictoffset && __pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8vcfutils___pyx_scope_struct__trimLeftPadding = &__pyx_type_8vcfutils___pyx_scope_struct__trimLeftPadding;
  if (PyType_Ready(&__pyx_type_8vcfutils___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_type_8vcfutils___pyx_scope_struct_1_genexpr.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8vcfutils___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_8vcfutils___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8vcfutils___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8vcfutils___pyx_scope_struct_1_genexpr = &__pyx_type_8vcfutils___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_8vcfutils___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
  __pyx_type_8vcfutils___pyx_scope_struct_2_genexpr.tp_print = 0;
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8vcfutils___pyx_scope_struct_2_genexpr.tp_dictoffset && __pyx_type_8vcfutils___pyx_scope_struct_2_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_8vcfutils___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_8vcfutils___pyx_scope_struct_2_genexpr = &__pyx_type_8vcfutils___pyx_scope_struct_2_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("fastafile"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_9fastafile_FastaIndex = __Pyx_ImportType(__pyx_t_1, "fastafile", "FastaIndex", sizeof(struct __pyx_obj_9fastafile_FastaIndex), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9fastafile_FastaIndex) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_vtabptr_9fastafile_FastaIndex = (struct __pyx_vtabstruct_9fastafile_FastaIndex*)__Pyx_GetVtable(__pyx_ptype_9fastafile_FastaIndex->tp_dict); if (unlikely(!__pyx_vtabptr_9fastafile_FastaIndex)) __PYX_ERR(1, 1, __pyx_L1_error)
  __pyx_ptype_9fastafile_FastaFile = __Pyx_ImportType(__pyx_t_1, "fastafile", "FastaFile", sizeof(struct __pyx_obj_9fastafile_FastaFile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9fastafile_FastaFile) __PYX_ERR(1, 5, __pyx_L1_error)
  __pyx_vtabptr_9fastafile_FastaFile = (struct __pyx_vtabstruct_9fastafile_FastaFile*)__Pyx_GetVtable(__pyx_ptype_9fastafile_FastaFile->tp_dict); if (unlikely(!__pyx_vtabptr_9fastafile_FastaFile)) __PYX_ERR(1, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", 
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("htslibWrapper"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_13htslibWrapper_Samfile = __Pyx_ImportType(__pyx_t_1, "htslibWrapper", "Samfile", sizeof(struct __pyx_obj_13htslibWrapper_Samfile), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_13htslibWrapper_Samfile) __PYX_ERR(5, 203, __pyx_L1_error)
  __pyx_vtabptr_13htslibWrapper_Samfile = (struct __pyx_vtabstruct_13htslibWrapper_Samfile*)__Pyx_GetVtable(__pyx_ptype_13htslibWrapper_Samfile->tp_dict); if (unlikely(!__pyx_vtabptr_13htslibWrapper_Samfile)) __PYX_ERR(5, 203, __pyx_L1_error)
  __pyx_ptype_13htslibWrapper_ReadIterator = __Pyx_ImportType(__pyx_t_1, "htslibWrapper", "ReadIterator", sizeof(struct __pyx_obj_13htslibWrapper_ReadIterator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_13htslibWrapper_ReadIterator) __PYX_ERR(5, 222, __pyx_L1_error)
  __pyx_vtabptr_13htslibWrapper_ReadIterator = (struct __pyx_vtabstruct_13htslibWrapper_ReadIterator*)__Pyx_GetVtable(__pyx_ptype_13htslibWrapper_ReadIterator->tp_dict); if (unlikely(!__pyx_vtabptr_13htslibWrapper_ReadIterator)) __PYX_ERR(5, 222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("variant"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7variant_Variant = __Pyx_ImportType(__pyx_t_1, "variant", "Variant", sizeof(struct __pyx_obj_7variant_Variant), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7variant_Variant) __PYX_ERR(6, 17, __pyx_L1_error)
  __pyx_vtabptr_7variant_Variant = (struct __pyx_vtabstruct_7variant_Variant*)__Pyx_GetVtable(__pyx_ptype_7variant_Variant->tp_dict); if (unlikely(!__pyx_vtabptr_7variant_Variant)) __PYX_ERR(6, 17, __pyx_L1_error)
  __pyx_ptype_7variant_VariantCandidateGenerator = __Pyx_ImportType(__pyx_t_1, "variant", "VariantCandidateGenerator", sizeof(struct __pyx_obj_7variant_VariantCandidateGenerator), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7variant_VariantCandidateGenerator) __PYX_ERR(6, 44, __pyx_L1_error)
  __pyx_vtabptr_7variant_VariantCandidateGenerator = (struct __pyx_vtabstruct_7variant_VariantCandidateGenerator*)__Pyx_GetVtable(__pyx_ptype_7variant_VariantCandidateGenerator->tp_dict); if (unlikely(!__pyx_vtabptr_7variant_VariantCandidateGenerator)) __PYX_ERR(6, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cwindow"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cwindow_ReadArray = __Pyx_ImportType(__pyx_t_1, "cwindow", "ReadArray", sizeof(struct __pyx_obj_7cwindow_ReadArray), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cwindow_ReadArray) __PYX_ERR(7, 13, __pyx_L1_error)
  __pyx_vtabptr_7cwindow_ReadArray = (struct __pyx_vtabstruct_7cwindow_ReadArray*)__Pyx_GetVtable(__pyx_ptype_7cwindow_ReadArray->tp_dict); if (unlikely(!__pyx_vtabptr_7cwindow_ReadArray)) __PYX_ERR(7, 13, __pyx_L1_error)
  __pyx_ptype_7cwindow_bamReadBuffer = __Pyx_ImportType(__pyx_t_1, "cwindow", "bamReadBuffer", sizeof(struct __pyx_obj_7cwindow_bamReadBuffer), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cwindow_bamReadBuffer) __PYX_ERR(7, 29, __pyx_L1_error)
  __pyx_vtabptr_7cwindow_bamReadBuffer = (struct __pyx_vtabstruct_7cwindow_bamReadBuffer*)__Pyx_GetVtable(__pyx_ptype_7cwindow_bamReadBuffer->tp_dict); if (unlikely(!__pyx_vtabptr_7cwindow_bamReadBuffer)) __PYX_ERR(7, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cpopulation"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_11cpopulation_Population = __Pyx_ImportType(__pyx_t_1, "cpopulation", "Population", sizeof(struct __pyx_obj_11cpopulation_Population), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_11cpopulation_Population) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_vtabptr_11cpopulation_Population = (struct __pyx_vtabstruct_11cpopulation_Population*)__Pyx_GetVtable(__pyx_ptype_11cpopulation_Population->tp_dict); if (unlikely(!__pyx_vtabptr_11cpopulation_Population)) __PYX_ERR(8, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("chaplotype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_10chaplotype_Haplotype = __Pyx_ImportType(__pyx_t_1, "chaplotype", "Haplotype", sizeof(struct __pyx_obj_10chaplotype_Haplotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_10chaplotype_Haplotype) __PYX_ERR(9, 14, __pyx_L1_error)
  __pyx_vtabptr_10chaplotype_Haplotype = (struct __pyx_vtabstruct_10chaplotype_Haplotype*)__Pyx_GetVtable(__pyx_ptype_10chaplotype_Haplotype->tp_dict); if (unlikely(!__pyx_vtabptr_10chaplotype_Haplotype)) __PYX_ERR(9, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("cgenotype"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_9cgenotype_DiploidGenotype = __Pyx_ImportType(__pyx_t_1, "cgenotype", "DiploidGenotype", sizeof(struct __pyx_obj_9cgenotype_DiploidGenotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9cgenotype_DiploidGenotype) __PYX_ERR(10, 9, __pyx_L1_error)
  __pyx_vtabptr_9cgenotype_DiploidGenotype = (struct __pyx_vtabstruct_9cgenotype_DiploidGenotype*)__Pyx_GetVtable(__pyx_ptype_9cgenotype_DiploidGenotype->tp_dict); if (unlikely(!__pyx_vtabptr_9cgenotype_DiploidGenotype)) __PYX_ERR(10, 9, __pyx_L1_error)
  __pyx_ptype_9cgenotype_HaploidGenotype = __Pyx_ImportType(__pyx_t_1, "cgenotype", "HaploidGenotype", sizeof(struct __pyx_obj_9cgenotype_HaploidGenotype), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_9cgenotype_HaploidGenotype) __PYX_ERR(10, 17, __pyx_L1_error)
  __pyx_vtabptr_9cgenotype_HaploidGenotype = (struct __pyx_vtabstruct_9cgenotype_HaploidGenotype*)__Pyx_GetVtable(__pyx_ptype_9cgenotype_HaploidGenotype->tp_dict); if (unlikely(!__pyx_vtabptr_9cgenotype_HaploidGenotype)) __PYX_ERR(10, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __pyx_t_1 = PyImport_ImportModule("variant"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "PLATYPUS_VAR", (void **)&__pyx_vp_7variant_PLATYPUS_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "FILE_VAR", (void **)&__pyx_vp_7variant_FILE_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "ASSEMBLER_VAR", (void **)&__pyx_vp_7variant_ASSEMBLER_VAR, "int") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("platypusutils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "binomial", (void (**)(void))&__pyx_f_13platypusutils_binomial, "double (int, int, double)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "betaBinomialCDF", (void (**)(void))&__pyx_f_13platypusutils_betaBinomialCDF, "double (int, int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initvcfutils(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initvcfutils(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_vcfutils(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_vcfutils(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_vcfutils(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'vcfutils' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_vcfutils(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("vcfutils", __pyx_methods, __pyx_k_Utility_code_for_Platypus_This, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_vcfutils) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "vcfutils")) {
      if (unlikely(PyDict_SetItemString(modules, "vcfutils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_variable_import_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_function_import_code() != 0)) goto __pyx_L1_error;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "vcfutils.pyx":6
 * """
 * 
 * import logging             # <<<<<<<<<<<<<<
 * import vcf
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":7
 * 
 * import logging
 * import vcf             # <<<<<<<<<<<<<<
 * 
 * cimport fastafile
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_vcf, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcf, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":35
 * from htslibWrapper cimport Read_SetQCFail
 * 
 * logger = logging.getLogger("Log")             # <<<<<<<<<<<<<<
 * 
 * canonicalBases = set(["A", "C", "T", "G"])
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getLogger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logger, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":37
 * logger = logging.getLogger("Log")
 * 
 * canonicalBases = set(["A", "C", "T", "G"])             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PySet_Add(__pyx_t_1, __pyx_n_s_A) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_C) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_T) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_s_G) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_canonicalBases, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":58
 * 
 * # Nasty global variables
 * cdef double LOG10_E = log10(exp(1.0))             # <<<<<<<<<<<<<<
 * cdef int CIGAR_M = 0 # Match
 * cdef int CIGAR_I = 1 # Insertion
 */
  __pyx_v_8vcfutils_LOG10_E = log10(exp(1.0));

  /* "vcfutils.pyx":59
 * # Nasty global variables
 * cdef double LOG10_E = log10(exp(1.0))
 * cdef int CIGAR_M = 0 # Match             # <<<<<<<<<<<<<<
 * cdef int CIGAR_I = 1 # Insertion
 * cdef int CIGAR_D = 2 # Deletion
 */
  __pyx_v_8vcfutils_CIGAR_M = 0;

  /* "vcfutils.pyx":60
 * cdef double LOG10_E = log10(exp(1.0))
 * cdef int CIGAR_M = 0 # Match
 * cdef int CIGAR_I = 1 # Insertion             # <<<<<<<<<<<<<<
 * cdef int CIGAR_D = 2 # Deletion
 * cdef int CIGAR_N = 3 # Skipped region from reference
 */
  __pyx_v_8vcfutils_CIGAR_I = 1;

  /* "vcfutils.pyx":61
 * cdef int CIGAR_M = 0 # Match
 * cdef int CIGAR_I = 1 # Insertion
 * cdef int CIGAR_D = 2 # Deletion             # <<<<<<<<<<<<<<
 * cdef int CIGAR_N = 3 # Skipped region from reference
 * cdef int CIGAR_S = 4 # Soft clipping. Sequence is present in read
 */
  __pyx_v_8vcfutils_CIGAR_D = 2;

  /* "vcfutils.pyx":62
 * cdef int CIGAR_I = 1 # Insertion
 * cdef int CIGAR_D = 2 # Deletion
 * cdef int CIGAR_N = 3 # Skipped region from reference             # <<<<<<<<<<<<<<
 * cdef int CIGAR_S = 4 # Soft clipping. Sequence is present in read
 * cdef int CIGAR_H = 5 # Hard clipping. Sequence is not present in read
 */
  __pyx_v_8vcfutils_CIGAR_N = 3;

  /* "vcfutils.pyx":63
 * cdef int CIGAR_D = 2 # Deletion
 * cdef int CIGAR_N = 3 # Skipped region from reference
 * cdef int CIGAR_S = 4 # Soft clipping. Sequence is present in read             # <<<<<<<<<<<<<<
 * cdef int CIGAR_H = 5 # Hard clipping. Sequence is not present in read
 * cdef int CIGAR_P = 6 # Padding. Used for padded alignment
 */
  __pyx_v_8vcfutils_CIGAR_S = 4;

  /* "vcfutils.pyx":64
 * cdef int CIGAR_N = 3 # Skipped region from reference
 * cdef int CIGAR_S = 4 # Soft clipping. Sequence is present in read
 * cdef int CIGAR_H = 5 # Hard clipping. Sequence is not present in read             # <<<<<<<<<<<<<<
 * cdef int CIGAR_P = 6 # Padding. Used for padded alignment
 * cdef int CIGAR_EQ = 7 # Alignment match; sequence match
 */
  __pyx_v_8vcfutils_CIGAR_H = 5;

  /* "vcfutils.pyx":65
 * cdef int CIGAR_S = 4 # Soft clipping. Sequence is present in read
 * cdef int CIGAR_H = 5 # Hard clipping. Sequence is not present in read
 * cdef int CIGAR_P = 6 # Padding. Used for padded alignment             # <<<<<<<<<<<<<<
 * cdef int CIGAR_EQ = 7 # Alignment match; sequence match
 * cdef int CIGAR_X = 8 # Alignment match; sequence mismatch
 */
  __pyx_v_8vcfutils_CIGAR_P = 6;

  /* "vcfutils.pyx":66
 * cdef int CIGAR_H = 5 # Hard clipping. Sequence is not present in read
 * cdef int CIGAR_P = 6 # Padding. Used for padded alignment
 * cdef int CIGAR_EQ = 7 # Alignment match; sequence match             # <<<<<<<<<<<<<<
 * cdef int CIGAR_X = 8 # Alignment match; sequence mismatch
 * 
 */
  __pyx_v_8vcfutils_CIGAR_EQ = 7;

  /* "vcfutils.pyx":67
 * cdef int CIGAR_P = 6 # Padding. Used for padded alignment
 * cdef int CIGAR_EQ = 7 # Alignment match; sequence match
 * cdef int CIGAR_X = 8 # Alignment match; sequence mismatch             # <<<<<<<<<<<<<<
 * 
 * ###################################################################################################
 */
  __pyx_v_8vcfutils_CIGAR_X = 8;

  /* "vcfutils.pyx":73
 * # Definititons for the individual and filter fields included in the header
 * vcfInfoSignature = {
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),             # <<<<<<<<<<<<<<
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(25); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_FR, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":74
 * vcfInfoSignature = {
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),             # <<<<<<<<<<<<<<
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_PP, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":75
 *     "FR":vcf.FORMAT('FR',1,".",'Float','Estimated population frequency of variant',-1),
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_TC, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":76
 *     "PP":vcf.FORMAT('PP',1,".",'Float','Posterior probability (phred scaled) that this variant segregates',-1),
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),             # <<<<<<<<<<<<<<
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_WS, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":77
 *     "TC":vcf.FORMAT('TC',1,1,'Integer','Total coverage at this locus',-1),
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),             # <<<<<<<<<<<<<<
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_WE, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":78
 *     "WS":vcf.FORMAT('WS',1,1,'Integer','Starting position of calling window',-1),
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_TCR, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":79
 *     "WE":vcf.FORMAT('WE',1,1,'Integer','End position of calling window',-1),
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),             # <<<<<<<<<<<<<<
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_TCF, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":80
 *     "TCR":vcf.FORMAT('TCR',1,1,'Integer','Total reverse strand coverage at this locus',-1),
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_TR, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":81
 *     "TCF":vcf.FORMAT('TCF',1,1,'Integer','Total forward strand coverage at this locus',-1),
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_NF, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":82
 *     "TR":vcf.FORMAT('TR',1,".",'Integer','Total number of reads containing this variant',-1),
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),             # <<<<<<<<<<<<<<
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_NR, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":83
 *     "NF":vcf.FORMAT('NF',1,".",'Integer','Total number of forward reads containing this variant',-1),
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),             # <<<<<<<<<<<<<<
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_MGOF, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":84
 *     "NR":vcf.FORMAT('NR',1,".",'Integer','Total number of reverse reads containing this variant',-1),
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),             # <<<<<<<<<<<<<<
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_SC, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":85
 *     "MGOF":vcf.FORMAT('MGOF',1,".",'Integer','Worst goodness-of-fit value reported across all samples',-1),
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),             # <<<<<<<<<<<<<<
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_HP, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":86
 *     "SC":vcf.FORMAT('SC',1,1,'String','Genomic sequence 10 bases either side of variant position',-1),
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),             # <<<<<<<<<<<<<<
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_BRF, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":87
 *     "HP":vcf.FORMAT('HP',1,1,'Integer','Homopolymer run length around variant locus',-1),
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),             # <<<<<<<<<<<<<<
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_MMLQ, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":88
 *     "BRF":vcf.FORMAT('BRF',1,1,'Float','Fraction of reads around this variant that failed filters',-1),
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),             # <<<<<<<<<<<<<<
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_QD, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":89
 *     "MMLQ":vcf.FORMAT('MMLQ',1,1,'Float','Median minimum base quality for bases around variant',-1),
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),             # <<<<<<<<<<<<<<
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Source, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":90
 *     "QD":vcf.FORMAT('QD',1,1,'Float','Variant-quality/read-depth for this variant',-1),
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_START, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":91
 *     "Source":vcf.FORMAT('Source',1,".",'String','Was this variant suggested by Playtypus, Assembler, or from a VCF?',-1),
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_END, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":92
 *     "START":vcf.FORMAT('START',1,".",'Integer','Start position of reference call block', -1),
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),             # <<<<<<<<<<<<<<
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Size_2, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":93
 *     "END":vcf.FORMAT('END',1,".",'Integer','End position of reference call block', -1),
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),             # <<<<<<<<<<<<<<
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_HapScore, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":94
 *     "Size":vcf.FORMAT('Size',1,".",'Integer','Size of reference call block', -1),
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),             # <<<<<<<<<<<<<<
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_MQ, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":95
 *     "HapScore":vcf.FORMAT('HapScore',1,".",'Integer','Haplotype score measuring the number of haplotypes the variant is segregating into in a window', -1),
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),             # <<<<<<<<<<<<<<
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_FS, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":96
 *     "MQ":vcf.FORMAT('MQ',1,".",'Float','Root mean square of mapping qualities of reads at the variant position',-1),
 *     "FS":vcf.FORMAT('FS',1,".",'Float','Fisher\'s exact test for strand bias (Phred scale)',-1),
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),             # <<<<<<<<<<<<<<
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 *     "ReadPosRankSum":vcf.FORMAT('ReadPosRankSum',1,".",'Float','Mann-Whitney Rank sum test for difference between in positions of variants in reads from ref and alt',-1),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_SbPval, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":98
 *     "SbPval":vcf.FORMAT('SbPval',1,".",'Float','Binomial P-value for strand bias test',-1),
 * #   "MQRankSum":vcf.FORMAT('MQRankSum',1,".",'Float','Mann-Whitney Rank sum test for mapping quality difference between ref and alt (Phred scale)',-1),
 *     "ReadPosRankSum":vcf.FORMAT('ReadPosRankSum',1,".",'Float','Mann-Whitney Rank sum test for difference between in positions of variants in reads from ref and alt',-1),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ReadPosRankSum, __pyx_t_2) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcfInfoSignature, __pyx_t_1) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":102
 * 
 * vcfFilterSignature = {
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),             # <<<<<<<<<<<<<<
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_alleleBias, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":103
 * vcfFilterSignature = {
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),             # <<<<<<<<<<<<<<
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_strandBias, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":104
 *     "alleleBias":vcf.FORMAT('alleleBias',1,0,'Flag','Variant frequency is lower than expected for het','.'),
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),             # <<<<<<<<<<<<<<
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_badReads, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":105
 *     "strandBias":vcf.FORMAT('strandBias',1,0,'Flag','Variant fails strand-bias filter','.'),
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),             # <<<<<<<<<<<<<<
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_MQ, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":106
 *     "badReads":vcf.FORMAT('badReads',1,0,'Flag','Variant supported only by reads with low quality bases close to variant position, and not present on both strands.','.'),
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),             # <<<<<<<<<<<<<<
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Q20, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":107
 *     "MQ":vcf.FORMAT('MQ',1,0,'Flag','Root-mean-square mapping quality across calling region is low.','.'),
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),             # <<<<<<<<<<<<<<
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_QualDepth, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":108
 *     "Q20":vcf.FORMAT('Q20',1,0,'Flag','Variant quality is below 20.','.'),
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),             # <<<<<<<<<<<<<<
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_HapScore, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":109
 *     "QualDepth":vcf.FORMAT('HapScore',1,0,'Flag','Too many haplotypes are supported by the data in this region.','.'),
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),             # <<<<<<<<<<<<<<
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_GOF, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":110
 *     "HapScore":vcf.FORMAT('QualDepth',1,0,'Flag','Variant quality/Read depth ratio is low.','.'),
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),             # <<<<<<<<<<<<<<
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_hp10, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":111
 *     "GOF":vcf.FORMAT('GOF',1,0,'Flag','Variant fails goodness-of-fit test.','.'),
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),             # <<<<<<<<<<<<<<
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_REFCALL, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":112
 *     "hp10":vcf.FORMAT('hp10',1,0,'Flag','Flanking sequence contains homopolymer of length 10 or greater','.'),
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),             # <<<<<<<<<<<<<<
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),
 * }
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_QD, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":113
 *     "REFCALL":vcf.FORMAT('REFCALL',1,0,'Flag','This line represents a homozygous reference call','.'),
 *     "QD":vcf.FORMAT('QD',1,0,'Flag','Variants fail quality/depth filter.','.'),
 *     "SC":vcf.FORMAT('SC',1,0,'Flag','Variants fail sequence-context filter. Surrounding sequence is low-complexity','.'),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_SC, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcfFilterSignature, __pyx_t_1) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":117
 * 
 * vcfFormatSignature = {
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),             # <<<<<<<<<<<<<<
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_GT, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":118
 * vcfFormatSignature = {
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),             # <<<<<<<<<<<<<<
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_GL, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":119
 *     "GT":vcf.FORMAT('GT',1,1,'String','Unphased genotypes','.'),
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),             # <<<<<<<<<<<<<<
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_GQ, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":120
 *     "GL":vcf.FORMAT('GL',1,'.','Float','Genotype log10-likelihoods for AA,AB and BB genotypes, where A = ref and B = variant. Only applicable for bi-allelic sites','.'),
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),             # <<<<<<<<<<<<<<
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_GOF, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":121
 *     "GQ":vcf.FORMAT('GQ',1,'.','Integer','Genotype quality as phred score','.'),
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),             # <<<<<<<<<<<<<<
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),
 * }
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_NR, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "vcfutils.pyx":122
 *     "GOF":vcf.FORMAT('GOF',1,'.','Float','Goodness of fit value','.'),
 *     "NR":vcf.FORMAT('NR',1,'.','Integer','Number of reads covering variant location in this sample','.'),
 *     "NV":vcf.FORMAT('NV',1,'.','Integer','Number of reads containing variant in this sample','.'),             # <<<<<<<<<<<<<<
 * }
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_vcf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_FORMAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_NV, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vcfFormatSignature, __pyx_t_1) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":127
 * ###################################################################################################
 * 
 * def outputSingleLineOfVCF(dict data, object outputFile, object vcfFile, options):             # <<<<<<<<<<<<<<
 *     """
 *     """
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8vcfutils_1outputSingleLineOfVCF, NULL, __pyx_n_s_vcfutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_outputSingleLineOfVCF, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":796
 * 
 * 
 * def trimLeftPadding(vcfDataLine):             # <<<<<<<<<<<<<<
 *     """
 *     This is a small hack to make sure that no un-needed left padding is left
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8vcfutils_3trimLeftPadding, NULL, __pyx_n_s_vcfutils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_trimLeftPadding, __pyx_t_1) < 0) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "vcfutils.pyx":1
 * """             # <<<<<<<<<<<<<<
 * Utility code for Platypus. This is mostly concerned with processing needed to produce
 * VCF output from the various data structures used by Platypus.
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "htslibWrapper.pxd":295
 *     theRead.bitFlag |= BAM_FCOMPRESSED
 * 
 * cdef inline void Read_SetUnCompressed(cAlignedRead* theRead) nogil:             # <<<<<<<<<<<<<<
 *     theRead.bitFlag &= (~BAM_FCOMPRESSED)
 * 
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init vcfutils", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init vcfutils");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

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

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

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

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

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

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

/* ArgTypeTest */
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if (likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod0 */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_ASSUME_SAFE_MACROS
    args = PyTuple_New(1);
    if (unlikely(!args)) goto bad;
    Py_INCREF(self);
    PyTuple_SET_ITEM(args, 0, self);
#else
    args = PyTuple_Pack(1, self);
    if (unlikely(!args)) goto bad;
#endif
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    Py_DECREF(args);
bad:
    return result;
}

/* py_dict_keys */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_keys, d);
    else
        return PyDict_Keys(d);
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

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

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

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

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

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

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyIntFromDouble */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#endif

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* StringJoin */
#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* py_abs */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            Py_SIZE(copy) = -(Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* SliceObject */
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

/* py_dict_values */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
    if (PY_MAJOR_VERSION >= 3)
        return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_values, d);
    else
        return PyDict_Values(d);
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

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

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

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

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

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
#else
    if (is_list || PySequence_Check(o))
#endif
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* pyobject_as_double */
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if ((0)) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyFloat_DivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\
    PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\
    return NULL;\
}
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: __Pyx_PyFloat_DivideCObj_ZeroDivisionError(0) break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyFloatBinop */
      #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* CallUnboundCMethod2 */
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* dict_getitem_default */
        static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* PyObject_GenericGetAttrNoDict */
        #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* TypeImport */
        #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
        static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Import */
        static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* CLineInTraceback */
        #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

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

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

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
        #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
        static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
        static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(PY_LONG_LONG) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (PY_LONG_LONG) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, digit, digits[0])
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) >= 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (PY_LONG_LONG) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (PY_LONG_LONG) 0;
                case -1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(PY_LONG_LONG,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(PY_LONG_LONG) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(PY_LONG_LONG) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) (((PY_LONG_LONG)-1)*(((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(PY_LONG_LONG) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(PY_LONG_LONG, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                            return (PY_LONG_LONG) ((((((((((PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (PY_LONG_LONG)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(PY_LONG_LONG) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(PY_LONG_LONG) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(PY_LONG_LONG, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            PY_LONG_LONG val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (PY_LONG_LONG) -1;
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (PY_LONG_LONG) -1;
        val = __Pyx_PyInt_As_PY_LONG_LONG(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to PY_LONG_LONG");
    return (PY_LONG_LONG) -1;
}

/* CIntFromPy */
        static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* FastTypeChecks */
        #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* FetchCommonType */
        static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* RaiseException */
        #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* GetTopmostException */
        #if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
        #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* SwapException */
        #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* CoroutineBase */
        #include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
        static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
        #ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
        static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

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

/* FunctionExport */
        static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* VoidPtrImport */
        #ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

/* FunctionImport */
        #ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

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

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
